ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Object required" error (https://www.excelbanter.com/excel-programming/405203-object-required-error.html)

Damien McBain[_4_]

"Object required" error
 
Hi,

Why does this produce an "Object Required" error and how can I fix it?
Column A contains worksheet names. Row 5 contains text representing a cell
reference like "G16".
==================
Sub FixFormulas1()
For Each x In Worksheets("Summary1").Range("B9:C30")
If Cells(x.Row, 1) < "" Then
x.Formula = "='" & Cells(x.Row, 1).Text & "'!" & Cells(5,
c.Column).Text
Else
End If
Next x
End Sub
==================
Thanks in advance,

Damien



Damien McBain[_4_]

"Object required" error - FOUND THE PROBLEM
 
Sorry - I answered my own question. I was using the wrong variable name
"c.column", should be "x.column"
doh

"Damien McBain" wrote in message
...
Hi,

Why does this produce an "Object Required" error and how can I fix it?
Column A contains worksheet names. Row 5 contains text representing a cell
reference like "G16".
==================
Sub FixFormulas1()
For Each x In Worksheets("Summary1").Range("B9:C30")
If Cells(x.Row, 1) < "" Then
x.Formula = "='" & Cells(x.Row, 1).Text & "'!" & Cells(5,
c.Column).Text
Else
End If
Next x
End Sub
==================
Thanks in advance,

Damien





All times are GMT +1. The time now is 01:53 PM.

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