copy value from above

muh6323

New Member
Joined
Jun 3, 2020
Messages
1
Office Version
  1. 2007
Platform
  1. Windows
i want to copy value from above cell and paste up to 5 cells
sheet 1.JPG
only
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Welcome to the forum :)
Select the cell to be copied and run macro below
VBA Code:
Sub CopyCell()
    Dim x As Long:      x = Application.InputBox("how many?", "", 5, , , , , 1)
    Dim cel As Range:   Set cel = ActiveCell
    If x > 5 Then x = 5
    cel.Copy cel.Offset(1).Resize(x)
End Sub
 
Last edited:
Upvote 0
Welcome to the MrExcel board!

Could it be this? (Test with a copy of your data)

VBA Code:
Sub CopyMultiples()
  Dim c As Range
  Const NumCopies As Long = 5
  
  For Each c In Columns("A").SpecialCells(xlConstants)
    c.Copy Destination:=c.Resize(NumCopies + 1)
  Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,476
Members
448,967
Latest member
visheshkotha

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