VBA Code - Copying data from a range to next range

Vishaal

Active Member
Joined
Mar 16, 2019
Messages
434
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Hi All,

Why the below code is not copying data to till last row

VBA Code:
Sub copytilllast()
LR = Cells(Rows.Count, 1).End(xlUp)(2).Row

    Range("N2").FormulaR1C1 = "Max"
    Range("N3").FormulaR1C1 = "Min"
    Range("O2").FormulaR1C1 = "=MAX(RC[-9]:R[4]C[-9])"
    Range("O3").FormulaR1C1 = "=MIN(R[-1]C[-8]:R[3]C[-8])"
    Range("P2:P3").FormulaR1C1 = "=ROUNDUP(RC[-1],0)"
    Range("Q2:Q3").FormulaR1C1 = "=RC[-1]+0.2"
    Range("N2:Q7").Copy Range("N2:Q" & LR)

End Sub

its only creating the data but not copying, pls check and solve
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,774
Seems like this would be better. HTH. Dave
Code:
Sub copytilllast()
LR = Cells(Rows.Count, 1).End(xlUp).Row

    Range("N2").FormulaR1C1 = "Max"
    Range("N3").FormulaR1C1 = "Min"
    Range("O2").FormulaR1C1 = "=MAX(RC[-9]:R[4]C[-9])"
    Range("O3").FormulaR1C1 = "=MIN(R[-1]C[-8]:R[3]C[-8])"
    Range("P2:P3").FormulaR1C1 = "=ROUNDUP(RC[-1],0)"
    Range("Q2:Q3").FormulaR1C1 = "=RC[-1]+0.2"
    Range("N2:Q7").Copy Range("N2:Q" & LR + 1)

End Sub
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,127,860
Messages
5,627,299
Members
416,237
Latest member
Tethys

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
Top