Simple Procedure Edit

Posted on 2014-08-13
Medium Priority
Last Modified: 2014-08-16
The following code, selects the next 500 lines and runs the code.

Sub MakeSIF_FromNext500Rows()
    Range(ActiveCell, ActiveCell.Offset(499, 0)).Copy
    Sheets("Order Line Items").Select
    Application.Run "CU50BySalesOrder.xlsm!insert_mktg_prog"
    Sheets("Order Line Items").Select
    Call ClearResetSIFSheet
    ActiveCell.Offset(500, 0).Select
End Sub

Open in new window

How do you chg this so it would work on whatever cells are pre-selected?  Need to chg Ln3 and Ln11
Please advise and thanks.
Question by:RWayneH
LVL 24

Accepted Solution

Ejgil Hedegaard earned 2000 total points
ID: 40258757
Change line 3 to Selection.Copy, and the pre-selected cells will be used.

What do you want to happen in line 11, when the cells are pre-selected.
LVL 27

Expert Comment

by:Glenn Ray
ID: 40258889
No points, but agreeing with Ejgil on line 3 change.  As for Line 11, it's really no longer necessary.  However, if you wanted the user's active cell to move to the next cell after the active selection (like it did above), you could change line 11 to:
ActiveCell.Offset(Selection.Rows.Count, 0).Select

Open in new window


Author Closing Comment

ID: 40264978
Thanks for the help.  I cannot believe I did not figure that out...

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question