Hey Guys,
I've just begun digging into excel, Macro's and VBA and have taken up a small task I get in work quite often and am trying to automate it.
Hit a sticking point, and wondering if someone could help me.
Excel files I get on a regular basis, vary in size, can be between 12,000 and 20000 rows. each data set has same columns etc. so it is uniform data.
I have set up a macro to pull in the data, add columns, formulas, headers etc - which I intend of including under a master file, and having a pivot with slicers to get what data I need, when I need it.
Issue is, I've got everything up and running - it is giving me the desired results, but when I done up the VBA code (admittedly pieced together from trial and error and online) I hardcoded the end cell for each specific function eg. C1:C17023 - which worked perfectly for the first data set, but obviously needs to be dynamic.
Below is one of many formula's I have put in, in order to auto-populate down the column.
Is there some way, before I actually start pulling in these ranges, that I can get the total rows, and put it into an integer variable - or something along them lines.
----------------------------------------------------------------------------
Range("C2").Formula = "=VLOOKUP(E2,Index!$B$45:$C$49,2,False)"
Range("C2").Select
Selection.AutoFill Destination:=Range("c2:C10686")
---------------------------------------------------------------------------
When I am first pulling in the data, I am selecting a range, which I know ill be in the data set, and basically doing a CTRL+A on it
--------------------------------------------------------------------------
Range("A15).Select
ActiveCell.CurrentRegion.Select
-------------------------------------------------------------------------
Then I am pasting into another sheet to add formula's etc.
Apologies for being so long winded! Help would be appreciated
I've just begun digging into excel, Macro's and VBA and have taken up a small task I get in work quite often and am trying to automate it.
Hit a sticking point, and wondering if someone could help me.
Excel files I get on a regular basis, vary in size, can be between 12,000 and 20000 rows. each data set has same columns etc. so it is uniform data.
I have set up a macro to pull in the data, add columns, formulas, headers etc - which I intend of including under a master file, and having a pivot with slicers to get what data I need, when I need it.
Issue is, I've got everything up and running - it is giving me the desired results, but when I done up the VBA code (admittedly pieced together from trial and error and online) I hardcoded the end cell for each specific function eg. C1:C17023 - which worked perfectly for the first data set, but obviously needs to be dynamic.
Below is one of many formula's I have put in, in order to auto-populate down the column.
Is there some way, before I actually start pulling in these ranges, that I can get the total rows, and put it into an integer variable - or something along them lines.
----------------------------------------------------------------------------
Range("C2").Formula = "=VLOOKUP(E2,Index!$B$45:$C$49,2,False)"
Range("C2").Select
Selection.AutoFill Destination:=Range("c2:C10686")
---------------------------------------------------------------------------
When I am first pulling in the data, I am selecting a range, which I know ill be in the data set, and basically doing a CTRL+A on it
--------------------------------------------------------------------------
Range("A15).Select
ActiveCell.CurrentRegion.Select
-------------------------------------------------------------------------
Then I am pasting into another sheet to add formula's etc.
Apologies for being so long winded! Help would be appreciated