I want to paste data into a cell but I only want to do it if the selected cell is blank, if it isn't then the data should be posted in the next blank cell in the column.
Any ideas on how to do this would be appreciated.
p5x
If you're adding information to a given column, say Column A, then the code below would find the next blank cell in column A, and, in this case, paste the contents of range C8 there.
Sub pleasepaste()
[C8].Copy
[A65536].End(xlUp).Offset(1, 0).PasteSpecial
End Sub
Tom
Thanks Tom, that worked great.
I only want about 40 cells that allow data to be input into, how do you get a message box to pop up once the limit has been reached?
thanks
On 2002-02-17 10:10, P5X wrote:
Thanks Tom, that worked great.
I only want about 40 cells that allow data to be input into, how do you get a message box to pop up once the limit has been reached?
thanks
If [A65536].End(xlup).Offset(1, 0).Row > 40 Then
MsgBox "Sorry...no more room"
Exit Sub
else
[A65536].End(xlUp).Offset(1, 0).PasteSpecial
end if This message was edited by Tom Morales on 2002-02-17 16:03 This message was edited by Tom Morales on 2002-02-17 16:07
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.