Simple Procedure Edit

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
    Range("H2").Select
    ActiveSheet.Paste
    Application.Run "CU50BySalesOrder.xlsm!insert_mktg_prog"
    Sheets("Order Line Items").Select
    Call ClearResetSIFSheet
    Sheets("MasterCopy").Select
    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.
RWayneHAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ejgil HedegaardCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Glenn RayExcel VBA DeveloperCommented:
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


-Glenn
0
RWayneHAuthor Commented:
Thanks for the help.  I cannot believe I did not figure that out...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.