I don't think this a question specific to single script, but rather a general "Why?" is this so question. I can write code that will work, but I don't know why the code I think should work, won't and I don't know the correct terms to do a deep search for an answer . . .
I've run into making the declarations (I think that's the correct term) shown below trying to keep code generic so I can use it without having to code in sheet names:
Dim ws As Worksheet
Dim wb As Workbook
'
Set ws = ActiveWorkbook
Set wb = ActiveSheet
"but"
wb.ws.Sort.SortFields.Clear
will error.
Why? Do you have to use ws =sheets("name") ?
TIA
Ron
I've run into making the declarations (I think that's the correct term) shown below trying to keep code generic so I can use it without having to code in sheet names:
Dim ws As Worksheet
Dim wb As Workbook
'
Set ws = ActiveWorkbook
Set wb = ActiveSheet
"but"
wb.ws.Sort.SortFields.Clear
will error.
Why? Do you have to use ws =sheets("name") ?
TIA
Ron