PDA

View Full Version : [SOLVED] VBA to populate with cells from another sheet?



roxnoxsox
01-22-2015, 04:48 AM
Hi all,

I'm trying to create a VBA formula for a button on my excel spreadsheet so that when clicked, it will display cells A1:A4 from Sheet2?

I'm sorry this is probably a really simple problem but I'm extremely new to VBA and can't wrap my head around it. Does anyone have any suggestions? Much appreciated!!

ashleyuk1984
01-22-2015, 06:43 AM
No problem in asking this question.
We all have to start somewhere :)
Where do you want the data to be displayed? I presume A1:A4 on sheet1?



Sub CopyData()
Sheets("Sheet2").Range("A1:A4").Copy Sheets("Sheet1").Range("A1")
End Sub

roxnoxsox
01-23-2015, 07:34 AM
Thank you, this worked great! It seems to make sense too so hopefully this will be useful in the future :) Thanks!