Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default If statement in Auto_Open

When an Excel Workbook opens, if cell A1 in Sheet1 contains nothing I
want Excel to run Macro1.

If cell A1 in Sheet1 contains the text "Hello", I want Excel to do
nothing.

I've tried this:

If (Sheet1)A:1 = "Hello"
Then
Range("A1").Select
Else
Macro1
End If

but VB gives me the red pen for the first two lines.

Any ideas?

Kind regards

Ian M
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default If statement in Auto_Open


If Sheets("Sheet1").Range("A1") = "Hello" The
Range("A1").Selec
Els
Macro
End I

----- Ian M wrote: ----

When an Excel Workbook opens, if cell A1 in Sheet1 contains nothing
want Excel to run Macro1

If cell A1 in Sheet1 contains the text "Hello", I want Excel to d
nothing

I've tried this

If (Sheet1)A:1 = "Hello
The
Range("A1").Selec
Els
Macro
End I

but VB gives me the red pen for the first two lines

Any ideas

Kind regard

Ian

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default If statement in Auto_Open

Chris

It works perfectly!

Thanks again for your help.

Kind regards

Ian M



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AUTO_OPEN Bob Barnes Excel Discussion (Misc queries) 2 February 6th 08 03:03 AM
Auto_open and more.... pcor New Users to Excel 2 December 1st 06 02:07 AM
Auto_open and more.... Mike New Users to Excel 0 November 30th 06 07:13 PM
Auto_open dan Excel Discussion (Misc queries) 7 May 21st 06 10:41 AM
Beyond AUTO_OPEN WarrenR Excel Programming 2 February 27th 04 03:57 AM


All times are GMT +1. The time now is 10:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"