set text in a cell

T

tripflex

Sub ProjectInfo()
Dim strDescription, strName As String
strName = InputBox("Please enter the PROJECT NAME as you would like it to
appear on all sheets.", "Project Name")
strDescription = InputBox("Please enter the PROJECT DESCRIPTION as you would
like it to appear on all sheets.", "Project Description")

If strName = "" Then GoTo err2
If strDescription = "" Then GoTo err2

Sheet1.Cells(b, 3).Value = strName
Sheet1.Cells(b, 4).Value = strDescription
Exit Sub

err2:
Call MsgBox("You must enter a project name AND description!", vbExclamation,
"Error! Must enter project name AND description")

End Sub


Can anybody tell me why i keep getting an error when i try to run this
script? It says application-defined or object-defined error.


Thanks!!
 
P

Per Jessen

Hi

The problem is Cells(b,3)

b is seen as a variable.

If you want to put the text in B3 then use this:

Range("B3").value=StrName

or

Cells(3,2).value=StrName 'Syntax Cells(row, Column number)

Hopes this helps

Regards,
Per
 
T

tripflex

OHHHH okay thanks a ton man!

Per Jessen said:
Hi

The problem is Cells(b,3)

b is seen as a variable.

If you want to put the text in B3 then use this:

Range("B3").value=StrName

or

Cells(3,2).value=StrName 'Syntax Cells(row, Column number)

Hopes this helps

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top