Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default auto run macro on open of workbook if cell a1=A

hi..

i need a macro to run when a user open the workbook.

should be something like.

if sheet1 range a1="a"
Application.Run "INVENTRY.xls!newday.newday"

if sheet1 range a1="b"
Application.Run "INVENTRY.xls!update.update"

if sheet1 range a1="c"
select sheet1 rangec115


i allready got the 2 macros (update & newday) working but need the workbook
to check the condition of range a1 in order to perform the various tasks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default auto run macro on open of workbook if cell a1=A

Hi,

Try this

Private Sub Workbook_Open()
Select Case Sheets("sheet1").Range("A1").Value
Case "a"
Application.Run "INVENTRY.xls!newday.newday"
Case "b"
Application.Run "INVENTRY.xls!update.update"
Case "c"
Sheets("Sheet1").Range("C15").Select
End Select
End Sub

Mike

"pswanie" wrote:

hi..

i need a macro to run when a user open the workbook.

should be something like.

if sheet1 range a1="a"
Application.Run "INVENTRY.xls!newday.newday"

if sheet1 range a1="b"
Application.Run "INVENTRY.xls!update.update"

if sheet1 range a1="c"
select sheet1 rangec115


i allready got the 2 macros (update & newday) working but need the workbook
to check the condition of range a1 in order to perform the various tasks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default auto run macro on open of workbook if cell a1=A

and this i paste in the

right click on thingie next to file and then view?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default auto run macro on open of workbook if cell a1=A

Sub RunWhenOpenDocument()

Select Case Range("Sheet1!A1").Value
Case "a"
Application.Run "INVENTRY.xls!newday.newday"
Case "b"
Application.Run "INVENTRY.xls!update.update"
Case Else
Range("Sheet1!C115").Select
End Select

End Sub

Save this macro in Sheet1, and in ThisWorkbook, under the event Open, insert
the line
Sheet1.RunWhenOpenDocument

Stephane Quenson

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1

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
How to code VBA: Auto open workbook and run macro March Excel Discussion (Misc queries) 4 November 8th 07 08:25 PM
auto-open macro lost within workbook windsurferLA Excel Programming 2 December 16th 06 11:09 PM
auto run macro on workbook open Mcasteel[_45_] Excel Programming 0 November 15th 04 03:04 PM
auto run macro on workbook open Mcasteel[_43_] Excel Programming 2 November 15th 04 02:57 PM
auto run macro at workbook open Juan Guemes Excel Programming 2 August 28th 04 10:55 PM


All times are GMT +1. The time now is 07:00 AM.

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

About Us

"It's about Microsoft Excel"