Copy To 1st Blank Cell

lorddrezz

New Member
Joined
Jun 27, 2011
Messages
5
Hey all,

I have an issue where i need to use a VBA code on a button that when clicked it copies the cell next to it and pastes it on another page in the 1st available blank cell. and when i put in another value in that same cell and click the button it would put that value in the next available blank cell (under the 1st one) and so on and so on.

What I have so far is
Sub Copy2Prod()
'
' Copy2Prod Macro
'
'
If Sheets("Production").Cells(A4) = "" Then
Sheets("CORR Quality Comments Template").Select
Range("C4").Select
Selection.Copy
Sheets("Production").Select
Range("A4").Select
ActiveSheet.Paste
Else
Sheets("CORR Quality Comments Template").Select
Range("C4").Select
Selection.Copy
Sheets("Production").Select
Range("A4:A60").Offset(1, 0).Select
ActiveSheet.Paste
End If
End Sub



Excel 2010 is what I have, can anyone assist?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
What is Cells(A4)??? Do you mean Range("A4")

There is also no need to do all that Selecting, you can work with ranges directly in VBA.

Why are you pasting blank cells? What are you trying to accomplish exactly?
 
Upvote 0
Basically in Cell C4 on the 1st sheet (CORR Quality Comments Template) I have a value that i type in. i have a button next to it. i click the button I want it to copy that value, and then look at the range A4 to A60 on the 2nd Sheet (Production) and go down the list to the 1st blank cell and paste it there.
 
Upvote 0
Basically in Cell C4 on the 1st sheet (CORR Quality Comments Template) I have a value that i type in. i have a button next to it. i click the button I want it to copy that value, and then look at the range A4 to A60 on the 2nd Sheet (Production) and go down the list to the 1st blank cell and paste it there.

range("a4").select
selection.end(xldown).Offset(1,0).select


will take you to first blank in your range
 
Upvote 0
Why the Select?

Code:
Range("A4").End(xlDown).Offset(1).PasteSpecial
 
Upvote 0
Basically in Cell C4 on the 1st sheet (CORR Quality Comments Template) I have a value that i type in. i have a button next to it. i click the button I want it to copy that value, and then look at the range A4 to A60 on the 2nd Sheet (Production) and go down the list to the 1st blank cell and paste it there.

Would this help?

Code:
Sub lorddrezz()
'

Sheets("Production").Range("A" & Rows.Count).End(xlUp)(2).Value = Sheets("CORR Quality Comments Template").Range("C4").Value


End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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