Hi,
I'm havingconsiderable trouble writing a macro to do the following:
1) Select aparticular sheet in the workbook
2) Select a cell inthat worksheet
3) Check using a forloop if sheets exists and then insert data into a table if true
The sheets I'mchecking for existence (whether they are visible or not visible does not matterto me) are named "01", "02", "03", ... ,"99".
I want to insert thevalue of a particular cell within the sheet being checked into the active cell.I also want to insert the sheet name into the cell immediately left of theactive cell.
4) Select the cellimmediately below the active cell until the for loop is completed
5) Select a cell atthe top of the sheet
This is what Ihave:
SubFormChecklistTitles()
'1)
Sheets("FORMCHECKLIST").Select
'2)
Range("C4").Select
'3)
Dim i As Integer
For i = 1 To 99
If Sheets("0" &i).exist Or Sheets(i).exist = True Then
If i <= 9 Then
ActiveCell.Value ="='0" & i & "'!$M$1"
Else
ActiveCell.Value ="=" & i & "'!$M$S1"
End If
'4)
ActiveCell.Offset(0, -1).Select
Else
End If
Next
'5)
Range("C1").Select
End Sub
Thanks in advancefor any help.
I'm havingconsiderable trouble writing a macro to do the following:
1) Select aparticular sheet in the workbook
2) Select a cell inthat worksheet
3) Check using a forloop if sheets exists and then insert data into a table if true
The sheets I'mchecking for existence (whether they are visible or not visible does not matterto me) are named "01", "02", "03", ... ,"99".
I want to insert thevalue of a particular cell within the sheet being checked into the active cell.I also want to insert the sheet name into the cell immediately left of theactive cell.
4) Select the cellimmediately below the active cell until the for loop is completed
5) Select a cell atthe top of the sheet
This is what Ihave:
SubFormChecklistTitles()
'1)
Sheets("FORMCHECKLIST").Select
'2)
Range("C4").Select
'3)
Dim i As Integer
For i = 1 To 99
If Sheets("0" &i).exist Or Sheets(i).exist = True Then
If i <= 9 Then
ActiveCell.Value ="='0" & i & "'!$M$1"
Else
ActiveCell.Value ="=" & i & "'!$M$S1"
End If
'4)
ActiveCell.Offset(0, -1).Select
Else
End If
Next
'5)
Range("C1").Select
End Sub
Thanks in advancefor any help.