Problem running code on a different sheet
Hi,
Can anyone help me out with this problem? (done with Office2000) It does exactly what it's supposed to do if I run it on sheet1, or, on a COPY of sheet1 renamed sheet4, but when I go to sheet2 or 3 and try to run it I get an error message???? (perhaps it's just my old machine playing up again, will enclose a zip copy)...PS I know the variables haven't been declared, but that made no difference... :bink:
TIA
Code:
Sub ShowForm()
'//Look in the A column for an empty row
With ActiveSheet.Range("A:A")
Set FromOrigin = .Find("", LookIn:=xlValues)
End With
'//Prompt for the number of columns required
NumColumns = Application.InputBox(prompt:="How many columns? (Enter an integer to continue)", Title:="NUMBER OF COLUMNS", Type:=2)
If NumColumns = Empty Then End
'//Set the default number of rows = 4
For Y = 0 To 3
For X = 0 To NumColumns - 1
With ActiveSheet
FromOrigin.Offset(Y, X).Select
'//read heading so can display it in input box
Heading = ActiveSheet.Range("A1").Offset(0, X)
DataIs = Application.InputBox(prompt:="Type in entry for " & Heading & " and hit Enter - leave blank or click Cancel to Exit", Title:=Heading, Type:=2)
If DataIs = Empty Then End
Selection.Value = DataIs
End With
Next X
Next Y
End Sub