Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Hru48
 
Posts: n/a
Default Getting a macro to repeat


I have a macro which changes the value of a listbox entry and then
copies its values from one excel sheet to another to be totalled up
later. I need this to be run at least 50 times automatically as I am
currently just hitting run every time.

Maco is below and I would really be gratful for any thoughts on this.

Cheers

Hayley


Sub tesIncrement2()
Range("D108:R108").Select
Selection.Copy
Windows("test").Activate
Range("B1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Windows("North_central_agent.xls").Activate
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Reference").Select
Windows("test").Activate


Range("A1").Select
Selection.Delete Shift:=xlUp
Selection.Copy
Windows("North_central_agent.xls").Activate
Range("H103").Select
ActiveSheet.Paste
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Summary").Select
Windows("test").Activate
Range("B1").Select
Application.CutCopyMode = False
Windows("North_central_agent.xls").Activate

End Sub


--
Hru48
------------------------------------------------------------------------
Hru48's Profile: http://www.excelforum.com/member.php...o&userid=24895
View this thread: http://www.excelforum.com/showthread...hreadid=396939

  #2   Report Post  
Excel_Geek
 
Posts: n/a
Default


What if you did this?


Sub tesIncrement2()

For x = 1 to 50

Range("D108:R108").Select
Selection.Copy
Windows("test").Activate
Range("B1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Windows("North_central_agent.xls").Activate
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Reference").Select
Windows("test").Activate


Range("A1").Select
Selection.Delete Shift:=xlUp
Selection.Copy
Windows("North_central_agent.xls").Activate
Range("H103").Select
ActiveSheet.Paste
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Summary").Select
Windows("test").Activate
Range("B1").Select
Application.CutCopyMode = False
Windows("North_central_agent.xls").Activate

Next x

End Sub


--
Excel_Geek
------------------------------------------------------------------------
Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
View this thread: http://www.excelforum.com/showthread...hreadid=396939

  #3   Report Post  
Hru48
 
Posts: n/a
Default


Thanks alot! Works like a charm


--
Hru48
------------------------------------------------------------------------
Hru48's Profile: http://www.excelforum.com/member.php...o&userid=24895
View this thread: http://www.excelforum.com/showthread...hreadid=396939

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
Repeat a command in a Macro Phil Osman Excel Discussion (Misc queries) 4 June 30th 05 01:23 AM
repeat macro formula to all cells dave glynn Excel Discussion (Misc queries) 8 March 10th 05 08:42 PM
Macro to repeat formulas in next row katiekay Excel Discussion (Misc queries) 5 February 10th 05 08:28 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
How to program an excel macro to repeat a series of keystrokes? Beancounter Excel Discussion (Misc queries) 8 January 22nd 05 11:51 PM


All times are GMT +1. The time now is 06:22 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"