Hi everyone.
I'm looking to write code for some macros that I'm creating, the only problem is that the way I'm doing it now is very tedious. I am manually changing the macro so that id references every tab individually. I'm wondering if there is a way to reference the series of sheets as a whole. Here are two examples of the macros...
-----------------------------------------------------------
1)
Sub RefCompData()
X = EssVRetrieve("Sheet 1", Null, 1)
X = EssVRetrieve("Sheet 2", Null, 1)
If X = 0 Then
MsgBox ("REFRESH SUCCESSFUL"
Else
MsgBox ("REFRESH FAILED - TRY AGAIN"
End If
Calculate
End Sub
2)
Sub HIDEROWS()
'
' Macro1 Macro
' Macro recorded 09/11/2003 by A953997
'
'
Sheets("Sheet 1"
.Select
range("P1"
.Select
range(Selection, Selection.End(xlDown)).Select
For Each X In Selection
If ActiveCell.Value = "HIDE" Then
Selection.EntireRow.Hidden = True
End If
If ActiveCell.Value = "SHOW" Then
Selection.EntireRow.Hidden = False
End If
ActiveCell.Offset(1, 0).Select
Next X
range("B10"
.Select
Sheets("Sheet 2"
.Select
range("P1"
.Select
range(Selection, Selection.End(xlDown)).Select
For Each X In Selection
If ActiveCell.Value = "HIDE" Then
Selection.EntireRow.Hidden = True
End If
If ActiveCell.Value = "SHOW" Then
Selection.EntireRow.Hidden = False
End If
ActiveCell.Offset(1, 0).Select
Next X
range("B10"
.Select
End Sub
-----------------------------------------------------------
Please let me know if there is an easier way to do this...otherwise I'll be writing a lot of unecesarry code.
Thanks alot,
Brandon
I'm looking to write code for some macros that I'm creating, the only problem is that the way I'm doing it now is very tedious. I am manually changing the macro so that id references every tab individually. I'm wondering if there is a way to reference the series of sheets as a whole. Here are two examples of the macros...
-----------------------------------------------------------
1)
Sub RefCompData()
X = EssVRetrieve("Sheet 1", Null, 1)
X = EssVRetrieve("Sheet 2", Null, 1)
If X = 0 Then
MsgBox ("REFRESH SUCCESSFUL"
Else
MsgBox ("REFRESH FAILED - TRY AGAIN"
End If
Calculate
End Sub
2)
Sub HIDEROWS()
'
' Macro1 Macro
' Macro recorded 09/11/2003 by A953997
'
'
Sheets("Sheet 1"
range("P1"
range(Selection, Selection.End(xlDown)).Select
For Each X In Selection
If ActiveCell.Value = "HIDE" Then
Selection.EntireRow.Hidden = True
End If
If ActiveCell.Value = "SHOW" Then
Selection.EntireRow.Hidden = False
End If
ActiveCell.Offset(1, 0).Select
Next X
range("B10"
Sheets("Sheet 2"
range("P1"
range(Selection, Selection.End(xlDown)).Select
For Each X In Selection
If ActiveCell.Value = "HIDE" Then
Selection.EntireRow.Hidden = True
End If
If ActiveCell.Value = "SHOW" Then
Selection.EntireRow.Hidden = False
End If
ActiveCell.Offset(1, 0).Select
Next X
range("B10"
End Sub
-----------------------------------------------------------
Please let me know if there is an easier way to do this...otherwise I'll be writing a lot of unecesarry code.
Thanks alot,
Brandon