Using Macros

tasha23xx

New Member
Joined
Jun 3, 2018
Messages
9
Hey,

I am going to record my first macro but I am a little confused as my example isn't the easiest.

I basically have a table on a second tab within the sheet which I will be using to pull data from however the table is an order export list so it will vary in size each time depending on how busy the sales have been.

How can I use this setup with a macro?

Any ideas or references would be amazing, thanks :)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You said:
I basically have a table on a second tab within the sheet

If by Tab you mean sheet. How do you have a second sheet within a sheet.
Or do you mean a second sheet within the Workbook.

Tell me the names of the two sheets and the Names of the Tables.

Now what do you want to do?
 
Upvote 0
You said:
I basically have a table on a second tab within the sheet

If by Tab you mean sheet. How do you have a second sheet within a sheet.
Or do you mean a second sheet within the Workbook.

Tell me the names of the two sheets and the Names of the Tables.

Now what do you want to do?

Thanks for your reply, sorry if I did not make myself clear.

I have data on sheet 2 which is taken from an export. The columns will always remain the same but the amount of rows will vary depending on how many sales we have had for that period.

On sheet 1 I have columns with formulas which are pulling various bits of data from the order details on sheet 2. I would normally drag them down to match the amount of rows on sheet 2 however I am asking how I can achieve this with the use of a macro to make it easier?

The sheets are just called Sheet 1 and Sheet 2 within the same workbook?

Thanks for your time :)
 
Upvote 0
How about
Code:
Sub AddFormulas()
   Dim lr As Long
   
   lr = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
   Sheets("Sheet1").Range("[COLOR=#0000ff]A2:H[/COLOR]" & lr).FillDown
End Sub
This assumes that your formulas are in row2 from cols A:H
Change to suit
 
Upvote 0
How about
Code:
Sub AddFormulas()
   Dim lr As Long
   
   lr = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
   Sheets("Sheet1").Range("[COLOR=#0000ff]A2:H[/COLOR]" & lr).FillDown
End Sub
This assumes that your formulas are in row2 from cols A:H
Change to suit

This worked perfectly - thanks so much for your help!
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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