ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run-time Error: '438' (https://www.excelbanter.com/excel-programming/429108-run-time-error-438-a.html)

Bishop

Run-time Error: '438'
 
Why doesn't this work:

For Each wb In Workbooks
'Test to see if wb's name is like "*C&A PF*.xlsm"
If wb.Name Like "*C&A PF*.xlsm" Then
With wb
CDLastRow = .Sheets("Catalyst Dump").Range("A" & Rows.Count) _
& .End(xlUp).Row
.Worksheets("Catalyst Dump").Columns("D").ColumnWidth = 18
End With
End If
Next

The line starting with CDLastRow is giving me the error. Object doesn't
support this property or method.

FSt1

Run-time Error: '438'
 
hi
try this syntax..

CDLastRow = .Sheets("Catalyst Dump").Range("A" & Rows.Count) _
.End(xlUp).Row

basicily, loose the ampersand.
regards
FSt1

"Bishop" wrote:

Why doesn't this work:

For Each wb In Workbooks
'Test to see if wb's name is like "*C&A PF*.xlsm"
If wb.Name Like "*C&A PF*.xlsm" Then
With wb
CDLastRow = .Sheets("Catalyst Dump").Range("A" & Rows.Count) _
& .End(xlUp).Row
.Worksheets("Catalyst Dump").Columns("D").ColumnWidth = 18
End With
End If
Next

The line starting with CDLastRow is giving me the error. Object doesn't
support this property or method.


Dave Peterson

Run-time Error: '438'
 
You're not concatenating a string he

CDLastRow = .Sheets("Catalyst Dump").Range("A" & Rows.Count) _
.End(xlUp).Row

The space-underscore is the continuation character for extending one logical
line of code to two physical lines.

Bishop wrote:

Why doesn't this work:

For Each wb In Workbooks
'Test to see if wb's name is like "*C&A PF*.xlsm"
If wb.Name Like "*C&A PF*.xlsm" Then
With wb
CDLastRow = .Sheets("Catalyst Dump").Range("A" & Rows.Count) _
& .End(xlUp).Row
.Worksheets("Catalyst Dump").Columns("D").ColumnWidth = 18
End With
End If
Next

The line starting with CDLastRow is giving me the error. Object doesn't
support this property or method.


--

Dave Peterson


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com