Varying Range - how will this effect my code?

geordie_ben

Board Regular
Joined
Jul 27, 2009
Messages
122
Apologies in advance for the basic question. I was slowly becoming a whizz at VBA a decade ago, but I'm picking it back up and need a few pointers

I'm making a macro to take info from sheet to another, and then to fill forumula that I've entered into the sheet already (that'll be a separate question to see if I can get the macro to insert the formula for me

The start of my code is:
Code:
    Range("A2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Nominal Products").Select
    Range("B2").Select
    ActiveSheet.Paste
    Range("A2").Select
    Application.CutCopyMode = False
    Selection.AutoFill Destination:=Range("A2:A196")
    Range("A2:A196").Select
The next time I run the macro there may be more or less entries on sheet one. As above my macro states the range as A2:A196 - will this cause me any issues?
 
Last edited by a moderator:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Afraid not today as posted on my phone when at work (so amazed that I didn't make any typos :biggrin:)
 
Last edited:
Upvote 0
What's confusing? was not by a computer and so only gave an answer to our last question in this post because I could answer the question by writing freehand without testing on my phone.

Can't do that with new threads.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top