View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Moving data from one part of a worksheet to another with a button

Hi Kyle,

Try:
'===============
Private Sub CommandButton1_Click()
Dim rng As Range
Dim sRng As Range
Dim dRng As Range

Set rng = Range("C16")
Set sRng = Range("A1:B1")
Set dRng = Cells(Rows.Count, "C").End(xlUp)(2)

sRng.Copy Destination:=IIf(IsEmpty(rng), rng, dRng)

End Sub
'<<===============

---
Regards,
Norman


wrote in message
oups.com...
I'd like to move a block of cells, say A1:B1 for simplicity to another
area (Say, C16:D16) with a button (macro).

Say I do this multiple times though, instead of having A1:B1 overwrite
the same cells, I'd want it to move to the next row down (C17:D17) and
move the data there.

Is this possible in an easy to program answer? I have VB programming
experience but NO experience with Excel, and whenever I look at excel
code, it's all gobblygook to me!