VBA to count rows from one sheet and to multiple that row count to copy a larger range in another sheet.

gaz_luv

New Member
Joined
Mar 22, 2023
Messages
1
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Guys,

Hope you can help.

I need to know some VBA code so that I can count the number of rows on one sheet (not including header row ) then apply that number to a formatted range

Part 1 Extract count.

Sheet 1 is an extract of data and has a row count of 4 but I only need a round count from Row 2 and down ie row count would = 3.

1679483859688.png


Part 2 Applying Row count to to copy a formatted sheet 2 dependent on row count value

Sheet 2 is a pre formatted range of cells


1679484054933.png


As you can see I would like to copy the number of formatted rows based on sheet 1 row count.

To be clear a
Sheet 1 row count = 1 would return sheet 2 copy range of A1:E9
Sheet 1 row count = 2 would return sheet 2 copy range of A1:E18
Sheet 1 row count = 3 would return sheet 2 copy range of A1:E27
and so on

I have no idea how to approach this so any help would be appreciated.

Thanks in advance
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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