ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   With statement question (https://www.excelbanter.com/excel-programming/420083-statement-question.html)

Patrick C. Simonds

With statement question
 
The code below works great if the worksheet "Holidays" is active. I need it
to work when Holidays is not the active worksheet.


With Sheets("Holidays")
If range("L1") = "No Picture" Then
Intentions.Show
End If
End With


Ron Rosenfeld

With statement question
 
On Sat, 15 Nov 2008 11:28:43 -0800, "Patrick C. Simonds"
wrote:

The code below works great if the worksheet "Holidays" is active. I need it
to work when Holidays is not the active worksheet.


With Sheets("Holidays")
If range("L1") = "No Picture" Then
Intentions.Show
End If
End With


Bad syntax.

Try:

With Sheets("Holidays")
If .range("L1") = "No Picture" Then
Intentions.Show
End If
End With

Note the "." before Range
--ron

Mike

With statement question
 
add the . before the range
.range("L1")
"Patrick C. Simonds" wrote:

The code below works great if the worksheet "Holidays" is active. I need it
to work when Holidays is not the active worksheet.


With Sheets("Holidays")
If range("L1") = "No Picture" Then
Intentions.Show
End If
End With




All times are GMT +1. The time now is 02:52 AM.

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