B
Bishop
Why can't I get the following code to work? I want this macro to find an
open workbook called "ExportedData---" (where the dashes could be be
anything) and perform the following actions. That's why I'm using the *
wildcard. For example, one instance of the workbook might be named
"ExportedData[2]" the next instance might be called "ExportedData[1]". As
you can see from my comments I've tried messing around with a few different
methods but just can't make it work. In this current setup I'm getting a
"Compile Error: Argument not Optional" and it highlights the word Workbooks
in the With statement.
Sub CatalystToTally()
'Dim wb As Range
'Dim ws As Range
'Set wb = Workbooks
'Set ws = Worksheets
With Workbooks Like "ExportedData*"
'.Rows(1).Delete Shift:=xlUp
.Rows("1:1").Delete Shift:=xlUp
.Columns(D).ColumnWidth = 13
.Columns(D).NumberFormat = "0"
.Cells.Select
.Selection.Copy
.ThisWorkbook.Worksheets("Catalyst Dump").Paste
End With
End Sub
open workbook called "ExportedData---" (where the dashes could be be
anything) and perform the following actions. That's why I'm using the *
wildcard. For example, one instance of the workbook might be named
"ExportedData[2]" the next instance might be called "ExportedData[1]". As
you can see from my comments I've tried messing around with a few different
methods but just can't make it work. In this current setup I'm getting a
"Compile Error: Argument not Optional" and it highlights the word Workbooks
in the With statement.
Sub CatalystToTally()
'Dim wb As Range
'Dim ws As Range
'Set wb = Workbooks
'Set ws = Worksheets
With Workbooks Like "ExportedData*"
'.Rows(1).Delete Shift:=xlUp
.Rows("1:1").Delete Shift:=xlUp
.Columns(D).ColumnWidth = 13
.Columns(D).NumberFormat = "0"
.Cells.Select
.Selection.Copy
.ThisWorkbook.Worksheets("Catalyst Dump").Paste
End With
End Sub