maverick93
New Member
- Joined
- Jan 7, 2010
- Messages
- 23
I have two worksheets and using a command button I would like to make all of the values the cells of ActiveSheet.range("D1:K40") = the values in Sheets("2").Range("D1:K40"). The problem is that when i do this nothing happens however if do it for an individual cell it works.
I guess what I'm asking is there an efficient way to write the code so that each of the cells in Range("D1:K40")
I can't use the cut an paste method because there are merged cells in one sheet and the formatting isn't exactly the same.
Thanks for any help
I guess what I'm asking is there an efficient way to write the code so that each of the cells in Range("D1:K40")
I can't use the cut an paste method because there are merged cells in one sheet and the formatting isn't exactly the same.
VBA Code:
Private Sub CommandButton1_Click()
ActiveSheet.Range("D1") = Sheets("2").Range("D1")
ActiveSheet.Range("E1") = Sheets("2").Range("E1")
ActiveSheet.Range("F1") = Sheets("2").Range("D1")
...
ActiveSheet.Range("D2") = Sheets("2").Range("D2")
ActiveSheet.Range("E2") = Sheets("2").Range("E2")
ActiveSheet.Range("F2") = Sheets("2").Range("D2")
End Sub
Thanks for any help