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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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,215,305
Messages
6,124,153
Members
449,146
Latest member
el_gazar

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