Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
In the code below, if I wanted to activate any sheet with a name that
included _U.csv, is there a wildcard I can use? Windows("Bel080607_u.csv").Activate Range("A:C,E:E,G:G").Select Range("G1").Activate Selection.Delete Shift:=xlToLeft Columns("A:A").Select Selection.Cut Columns("C:C").Select Selection.Insert Shift:=xlToRight Range("A2:C350").Select Selection.Copy Windows("WiseGuy66.XLT").Activate Sheets("R1").Select ActiveWindow.LargeScroll Down:=1 Range("B62").Select ActiveSheet.Paste ActiveWindow.ScrollRow = 1 Range("A1").Select Sheets("DataSorter").Select Range("A1").Select End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
and close the sheet once the code is complete.
The reason for the wildcard is that the _u sheets come in different names every day "Shu of AZ" wrote: In the code below, if I wanted to activate any sheet with a name that included _U.csv, is there a wildcard I can use? Windows("Bel080607_u.csv").Activate Range("A:C,E:E,G:G").Select Range("G1").Activate Selection.Delete Shift:=xlToLeft Columns("A:A").Select Selection.Cut Columns("C:C").Select Selection.Insert Shift:=xlToRight Range("A2:C350").Select Selection.Copy Windows("WiseGuy66.XLT").Activate Sheets("R1").Select ActiveWindow.LargeScroll Down:=1 Range("B62").Select ActiveSheet.Paste ActiveWindow.ScrollRow = 1 Range("A1").Select Sheets("DataSorter").Select Range("A1").Select End Sub |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Nope.
But you can loop through the workbooks collection: Dim wkbk as workbook dim FoundIt as boolean Foundit = false for each wkbk in application.workbooks if lcase(wkbk.name) like lcase("*_U.csv") then foundit = true exit for end if next wkbk if foundit = true then wkbk.activate else msgbox "No workbook names match!" end if Shu of AZ wrote: and close the sheet once the code is complete. The reason for the wildcard is that the _u sheets come in different names every day "Shu of AZ" wrote: In the code below, if I wanted to activate any sheet with a name that included _U.csv, is there a wildcard I can use? Windows("Bel080607_u.csv").Activate Range("A:C,E:E,G:G").Select Range("G1").Activate Selection.Delete Shift:=xlToLeft Columns("A:A").Select Selection.Cut Columns("C:C").Select Selection.Insert Shift:=xlToRight Range("A2:C350").Select Selection.Copy Windows("WiseGuy66.XLT").Activate Sheets("R1").Select ActiveWindow.LargeScroll Down:=1 Range("B62").Select ActiveSheet.Paste ActiveWindow.ScrollRow = 1 Range("A1").Select Sheets("DataSorter").Select Range("A1").Select End Sub -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vb code question | Excel Discussion (Misc queries) | |||
vb code question | Excel Discussion (Misc queries) | |||
question on VB code | Excel Discussion (Misc queries) | |||
VB Code Question | Excel Discussion (Misc queries) | |||
VBA code question | Excel Discussion (Misc queries) |