Copy cell of one sheet to another sheet
I need a macro that will copy Cell C3 from one sheet and add it to another
sheet starting at A5. If A5 already has something in it then use A6 Thx Bob |
Copy cell of one sheet to another sheet
Sub dk()
Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row sh.Range("C3").Copy sh2.Range("A" & lr+1) End Sub Change the sheet names to suit. "Bobbo" wrote in message ... I need a macro that will copy Cell C3 from one sheet and add it to another sheet starting at A5. If A5 already has something in it then use A6 Thx Bob |
Copy cell of one sheet to another sheet
Try this. Modify sheet name to suit
Sub copyc3toothersheet() With Sheets("sheet14") If Len(Application.Trim(.Range("a5"))) < 1 Then lr = 5 Else lr = .Cells(4, "a").End(xlDown).Row + 1 End If 'MsgBox lr Range("c3").Copy .Cells(lr, "a") End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Bobbo" wrote in message ... I need a macro that will copy Cell C3 from one sheet and add it to another sheet starting at A5. If A5 already has something in it then use A6 Thx Bob |
Copy cell of one sheet to another sheet
What if there is something in cell a12
-- Don Guillett Microsoft MVP Excel SalesAid Software "JLGWhiz" wrote in message ... Sub dk() Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row sh.Range("C3").Copy sh2.Range("A" & lr+1) End Sub Change the sheet names to suit. "Bobbo" wrote in message ... I need a macro that will copy Cell C3 from one sheet and add it to another sheet starting at A5. If A5 already has something in it then use A6 Thx Bob |
Copy cell of one sheet to another sheet
Forgot starting in A5
Sub dk() Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row If shw.Range("A5") = "" Then sh.Range("C3").Copy sh2.Range("A5") Else sh.Range("C3").Copy sh2.Range("A" & lr+1) End If End Sub Change the sheet names to suit. "JLGWhiz" wrote in message ... Sub dk() Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row sh.Range("C3").Copy sh2.Range("A" & lr+1) End Sub Change the sheet names to suit. "Bobbo" wrote in message ... I need a macro that will copy Cell C3 from one sheet and add it to another sheet starting at A5. If A5 already has something in it then use A6 Thx Bob |
Copy cell of one sheet to another sheet
Had a typo:
Sub dk() Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row If sh2.Range("A5") = "" Then sh.Range("C3").Copy sh2.Range("A5") Else sh.Range("C3").Copy sh2.Range("A" & lr+1) End If End Sub "JLGWhiz" wrote in message ... Forgot starting in A5 Sub dk() Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row If shw.Range("A5") = "" Then sh.Range("C3").Copy sh2.Range("A5") Else sh.Range("C3").Copy sh2.Range("A" & lr+1) End If End Sub Change the sheet names to suit. "JLGWhiz" wrote in message ... Sub dk() Dim lr As Long, sh As Worksheet, sh2 As Worksheet Set sh = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row sh.Range("C3").Copy sh2.Range("A" & lr+1) End Sub Change the sheet names to suit. "Bobbo" wrote in message ... I need a macro that will copy Cell C3 from one sheet and add it to another sheet starting at A5. If A5 already has something in it then use A6 Thx Bob |
All times are GMT +1. The time now is 02:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com