stoggie
02-05-2007, 07:39 AM
Having some difficulty with the macor and hoping someone will be able to help.
Macro:
***********
Sub MacroPAK()
'
'
'
Sheets("PIVOT").Select
For i = 0 To 100
'Note: This goes to 100 since there might be up to 100 rows in the pivot table of CISCOs.
Sheets("PIVOT").Range("A5").Select
Sheets("PIVOT").Range("A5").Activate
'Note: A5 being the location of the first cell in the CISCO column of the pivot table
If ActiveCell.Offset(i, 0).Value <> Sheets("Sheet2").Range("B5").Value Then
Next i
'Note: "If not a match, then go on to the next row in the pivot table."
'Note: Activecell.offset(i,0) looks at the cell i rows down and 0 columns over from the active cell (which is A5)
'Note: B6 is the cell on the Cover Page that holds the user's selection.
Else
ActiveCell.Offset(i, 1).Select
'Note: This command selects the data cell 1 row over from the matching CISCO.
'Note: If the data cell is a different number of rows over, change the "1" appropriately.
Selection.ShowDetail = True
'Note: This command brings up all the detail behind that pivot table data cell.
Next i
End If
'Note: "If match is found, stop searching and give control back to the user."
End Sub
*************
The "Next is highlighted with the Error: "Next without For". But there is a For.
Then I change the Next to "SelectRange.FindNext", another error appears with the End Sub highlighted: "For without Next"
Any help is GREATLY appreciated.
Macro:
***********
Sub MacroPAK()
'
'
'
Sheets("PIVOT").Select
For i = 0 To 100
'Note: This goes to 100 since there might be up to 100 rows in the pivot table of CISCOs.
Sheets("PIVOT").Range("A5").Select
Sheets("PIVOT").Range("A5").Activate
'Note: A5 being the location of the first cell in the CISCO column of the pivot table
If ActiveCell.Offset(i, 0).Value <> Sheets("Sheet2").Range("B5").Value Then
Next i
'Note: "If not a match, then go on to the next row in the pivot table."
'Note: Activecell.offset(i,0) looks at the cell i rows down and 0 columns over from the active cell (which is A5)
'Note: B6 is the cell on the Cover Page that holds the user's selection.
Else
ActiveCell.Offset(i, 1).Select
'Note: This command selects the data cell 1 row over from the matching CISCO.
'Note: If the data cell is a different number of rows over, change the "1" appropriately.
Selection.ShowDetail = True
'Note: This command brings up all the detail behind that pivot table data cell.
Next i
End If
'Note: "If match is found, stop searching and give control back to the user."
End Sub
*************
The "Next is highlighted with the Error: "Next without For". But there is a For.
Then I change the Next to "SelectRange.FindNext", another error appears with the End Sub highlighted: "For without Next"
Any help is GREATLY appreciated.