Excel Macro 'Sheet.Range.Value' Syntax Questions
Try removing the quotes from ProjectSheet1.
Dim ProjectSheet1 As String
Dim ProjectSheet2 As String
ProjectSheet1 = Sheets(1).Range("C6").Value
ProjectSheet1 = Sheets(1).Range("C7").Value
I'd like to extract certain information using data from the "Criteria" sheet
like this:
Sheets(ProjectSheet1).Columns("A:B").AdvancedFilte r Action:= _
xlFilterCopy, CriteriaRange:=Sheets("Criteria").Range("A2:A3"),
CopyToRange _
:=Columns("A:B"), Unique:=True
Does that help?
Paul
--
"Elliott" wrote in message
...
I've got a few very basic syntax questions.
On my main worksheet, I've got a list of sheet names.
I've saved them as variables using the following commands:
Dim ProjectSheet1 As String
Dim ProjectSheet2 As String
ProjectSheet1 = Sheets(1).Range("C6").Value
ProjectSheet1 = Sheets(1).Range("C7").Value
I'd like to extract certain information using data from the "Criteria"
sheet
like this:
Sheets("ProjectSheet1").Columns("A:B").AdvancedFil ter Action:= _
xlFilterCopy, CriteriaRange:=Sheets("Criteria").Range("A2:A3"),
CopyToRange _
:=Columns("A:B"), Unique:=True
This places the information on the active sheet. That's fine, except that
the Sheets("ProjectSheet1") isn't working. If I input the actual sheet
name
in quotes, everything runs fine. ProjectSheet1 also doesn't work without
quotes.
|