Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Enter text in a cell to return a text value in same cell | Excel Discussion (Misc queries) | |||
Find text in a cell and copy text to another cell | Excel Discussion (Misc queries) | |||
Copy text from cell to cell with one cell changing text | Excel Worksheet Functions | |||
linking a cell containing text to another cell containing text / data | Excel Discussion (Misc queries) | |||
New text added to cell AFTER current text in same cell | Excel Worksheet Functions |