#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default set text in a cell

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!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default set text in a cell

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



"tripflex" skrev i meddelelsen
...
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!!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default set text in a cell

OHHHH okay thanks a ton man!

"Per Jessen" wrote:

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



"tripflex" skrev i meddelelsen
...
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!!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter text in a cell to return a text value in same cell Danno 24/7[_2_] Excel Discussion (Misc queries) 6 May 9th 08 06:26 AM
Find text in a cell and copy text to another cell Shaun Excel Discussion (Misc queries) 6 July 4th 07 05:25 PM
Copy text from cell to cell with one cell changing text Bobby Excel Worksheet Functions 5 March 15th 07 11:09 PM
linking a cell containing text to another cell containing text / data gin2000 Excel Discussion (Misc queries) 5 May 19th 06 09:08 PM
New text added to cell AFTER current text in same cell choc_penguin Excel Worksheet Functions 2 April 11th 06 08:23 PM


All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"