LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default macro to standard module

I have a .xlt with 2 macros in it.
The .xlt is copied in code from Access to a .xls and then data is
transferred from Access to the .xls
Both of the macros are activated on click of seperate command buttons.
The command buttons are in Sheet1 (Code) the sheet name is "Summary"
Macro 1 runs fine but I am getting an error on the 2nd as below.
Private Sub CommandButton2_Click()
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long

With Worksheets("Summary")
FirstRow = 2
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With

For iRow = FirstRow To LastRow
Next iRow

Range("A" & iRow).Select
ActiveCell.Value = "Assets"
ActiveCell.Font.Bold = True
ActiveCell.Font.Size = 12
Sheets("Assets").Select ERROR HERE Run-time error 1004 select method of
range class failed

I have discovered thanks to usergroup that this needs to be in a standard
module.
Can someone tell me how I do this and then how do I call it.
Thank you



 
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
macro in excel to call a access module to run. [email protected] Excel Discussion (Misc queries) 0 April 23rd 07 08:59 PM
Assigning a module to a button macro DMB Excel Discussion (Misc queries) 2 January 19th 06 12:37 AM
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
How do I copy a new module to 200 workbooks with a macro? Patrick Young Excel Worksheet Functions 1 September 3rd 05 04:35 PM


All times are GMT +1. The time now is 08:59 AM.

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"