Macro to find empty cell and copy data

aadhyaa

New Member
Joined
Oct 4, 2017
Messages
9
The code below copies data just as I want, but starting from A1. I want it to start from F12 and then copy in the next empty cell in F column everytime I run the macro. please help !

Code:
Sub ProductList()

Sheets("Data").Select
Range("C5:D48").Select
Selection.Copy
Sheets("Sales").Select
If Application.WorksheetFunction.CountA("A:A") = 0 Then
Selection.PasteSpecial Paste:=xlPasteValues
Else
On Error Resume Next
Columns(1).SpecialCells(xlCellTypeBlanks)(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
If Err <> 0 Then
On Error GoTo 0
[F65536].End(xlUp).Select
End If
On Error GoTo 0
End If
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
dim lrow as long

lrow = sheets("Sales").range("F" & rows.count).end(xlup).row
sheets("Sales").range("F" & lrow +1).pastespecial xlpastevalues
 
Upvote 0
Hello sir,

Could you please guide me what part of the code to replace with the code you have given ?
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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