Paste Value between sheets with starting range

Peteor

Board Regular
Joined
Mar 16, 2018
Messages
152
I would like to find the first empty cell on a worksheet after I define a starting point for the range. Here is where I am stuck:

Rng = Sheets("Sheet 1").Range("X:X")

For Each Cel In Rng
If Cel.Value >= 50 Then
Rng.Offset(, -21).Copy
'Paste to cell on different sheet starting with cell A46
Rng.Offset(,-5).Copy
'Paste to cell on different sheet starting with cell B46
Rng.Offset(,-4).Copy
'Paste to cell on different sheet starting with cell C46
Cel.Copy
'Paste to cell on different sheet starting with cell D46
Else
End If

Next Cel

Also, is there a better/faster way of doing this? is there maybe a way to condense it all into 1 copy and 1 paste?
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Code:
Sub test()
    Set Rng = Sheets("Sheet 1").Range("X:X")
    If WorksheetFunction.CountA(Rng) = 0 Then GoTo safeExit
    For Each cel In Rng.SpecialCells(xlCellTypeConstants)
        If cel.Value >= 50 Then
            With Sheets("Sheet2")
                son = .Cells(Rows.Count, 1).End(3).Row + 1
                If son < 46 Then son = 46
                Union(cel.Offset(, -21), cel.Offset(, -5).Resize(, 2), cel).Copy .Cells(son, 1)
            End With
        End If
    Next cel
    Exit Sub
safeExit:
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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