jbstream09
New Member
- Joined
- Oct 13, 2017
- Messages
- 4
Hi,
I am new to VBA, is there a way to activate a workbook from another active workbook without the filename, and searching by the sheet1 instead?
I currently have; Windows("123456789.xls").Activate ,which works fine, however the file name constantly changes (always 9 characters) and I would prefer to activate the workbook by the tab name sheet1 instead.
Current active workbook I have:
Sub TEST6()
With Worksheets("Untitled").Columns(11)
.NumberFormat = "0"
.Value = .Value
End With
Range("A1").Select
ActiveWorkbook.Worksheets("Untitled").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Untitled").Sort.SortFields.Add Key:=Range( _
"A2:A65536"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Untitled").Sort
.SetRange Range("A1:L65536")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Windows("123456789.xls").Activate
I am new to VBA, is there a way to activate a workbook from another active workbook without the filename, and searching by the sheet1 instead?
I currently have; Windows("123456789.xls").Activate ,which works fine, however the file name constantly changes (always 9 characters) and I would prefer to activate the workbook by the tab name sheet1 instead.
Current active workbook I have:
Sub TEST6()
With Worksheets("Untitled").Columns(11)
.NumberFormat = "0"
.Value = .Value
End With
Range("A1").Select
ActiveWorkbook.Worksheets("Untitled").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Untitled").Sort.SortFields.Add Key:=Range( _
"A2:A65536"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Untitled").Sort
.SetRange Range("A1:L65536")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Windows("123456789.xls").Activate