Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem asttaching macro to form button

Thanks guys for helping! I used both sugestions and edited the code a bit
and it works great!


"dianeha" wrote:

Good morning to all!

I am trying to attach a macro I created to a form button in excel 2003. I
click the button however the macro will not run. I thought it might hav
ebeen the security level but I changed that. If anyone can assist me it
would be appreciated. I am new to VBA so please be kind.

Thanks!
Hamm


Sub Clean_for_New_Month()
'
' Clean_for_New_Month Macro
' Macro recorded 12/3/2007 by Diane Hamm
'
' Keyboard Shortcut: Ctrl+q
'
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("ATL").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I41").Select
Selection.Interior.ColorIndex = xlNone
Sheets("BAC").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("BLV").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I41").Select
Selection.Interior.ColorIndex = xlNone
Sheets("CAC").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("CCR").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("CHE").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("CLV").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I41").Select
Selection.Interior.ColorIndex = xlNone
Sheets("COU").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("FLV").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I45").Select
Selection.Interior.ColorIndex = xlNone
Sheets("FTN").Select
Range("H8:I46").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("GBI").Select
Range("H8:I46").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("GTU").Select
Range("H8:I46").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("HBR").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("HLT").Select
ActiveWindow.SmallScroll Down:=-6
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("JOL").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("LAD").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("LAS").Select
ActiveWindow.SmallScroll Down:=-9
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I41").Select
Selection.Interior.ColorIndex = xlNone
Sheets("LAU").Select
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("MET").Select
ActiveWindow.SmallScroll Down:=-9
Range("H8:I41").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Range("H25").Select
ActiveWindow.SmallScroll Down:=18
ActiveWindow.ScrollWorkbookTabs Sheets:=16
Sheets(Array("NKC", "NOR", "REN", "RIN", "RLV", "SAC", "STL", "STU",
"TAH", "UBC", "UEL", _
"UHA", "UTU", "WCL")).Select
Sheets("WCL").Activate
ActiveWorkbook.Sheets("WCL").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("UTU").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("UHA").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("UEL").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("UBC").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("TAH").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("STU").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("STL").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("SAC").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("RLV").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("RIN").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("REN").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("NOR").Tab.ColorIndex = -4142
ActiveWorkbook.Sheets("NKC").Tab.ColorIndex = -4142
Sheets(Array("NKC", "NOR", "REN", "RIN", "RLV", "SAC", "STL", "STU",
"TAH", "UBC", "UEL", _
"UHA", "UTU", "WCL")).Select
Sheets("NKC").Activate
ActiveWindow.SmallScroll Down:=-9
Range("H8:I44").Select
Selection.ClearContents
Range("G8:I46").Select
Selection.Interior.ColorIndex = xlNone
Sheets("X").Select
Range("H67").Select
ActiveWindow.SmallScroll Down:=-54
Sheets("WCL").Select
Range("K45").Select

End Sub




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
Form Command Button Problem.. Don Excel Programming 3 July 8th 06 02:17 AM
Attaching a macro to a VB button on a form WildGlio Excel Worksheet Functions 2 March 25th 05 11:11 PM
Excel VBA User Form - button problem weakissues Excel Programming 1 June 13th 04 05:12 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM
Macro to activate form button kkknie[_90_] Excel Programming 1 May 11th 04 08:31 PM


All times are GMT +1. The time now is 06:43 PM.

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"