dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,392
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to sort a table by the date column with this code:
Combo has the relevant sheet name stored within it and the table goes up column Q. Can anyone tell me what I have done wrong with this code please as it gives me a syntax error and highlights the range(combo) line of code?
Thanks,
Dave
Code:
'declare variables
Dim combo As String 'Combo worksheet name
'assign values to variables
combo = Worksheets("Home").Range("Q5") 'string in cell Q5 of Home worksheet
Range(combo).CurrentRegion.Sortkey1:=Range("Date of work"), order1:=xlAscending, Header:=xlYes
Combo has the relevant sheet name stored within it and the table goes up column Q. Can anyone tell me what I have done wrong with this code please as it gives me a syntax error and highlights the range(combo) line of code?
Thanks,
Dave