LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default More efficient macro help

Below are two iterations within my macro. Basically, it does this 14 times,
each time, changing the row reference by adding 9 more rows in the first
line - that's all the difference you will see in the two sets of macro text
below. Right now I have 14 of these, but I imagine I only need one, if I
somehow build a loop to add 9 rows and repeat. Can you help me with that?

Application.Goto Reference:="R7C15"
ActiveCell.Range("A1:A5").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ClearContents
ActiveCell.Offset(-1, -1).Range("A1:A6").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Table RowInput:=Range("P2"), ColumnInput:=Range("E12")

Application.Goto Reference:="R16C15"
ActiveCell.Range("A1:A5").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ClearContents
ActiveCell.Offset(-1, -1).Range("A1:A6").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Table RowInput:=Range("P2"), ColumnInput:=Range("E12")

Also, rather than making 10 copies of the above, I would like the
ColumnInput index parameter, currently "E12", for the data table to change
based on what text I have in a certain worksheet cell, say cell A1 (of the
current worksheet). For example, if cell a1 = "joe", rather than "jane",
then the column reference in the data table should be cell F10, not E12, and
so on for about 6 choices in cell A1. Can you also help me incorporate such
a variable cell reference? This is independent of what I've asked for in the
paragraph above. In other words, this data table columninput would be the
same for all 14 loops.

Thanks so much!
Dean



 
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
more efficient VBA? markx Excel Programming 4 August 7th 06 05:41 PM
Is there a more efficient way to do this? Steve Roberts Excel Programming 1 September 26th 05 05:34 PM
VBA - Efficient Macro ajocius[_17_] Excel Programming 3 August 3rd 05 12:34 PM
More efficient way? Steph[_3_] Excel Programming 6 June 23rd 04 09:34 PM
Which is more efficient? Norm[_5_] Excel Programming 3 April 2nd 04 04:24 PM


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