View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Chris Bode via OfficeKB.com Chris Bode via OfficeKB.com is offline
external usenet poster
 
Posts: 47
Default How can I programatically move cell contents

Please follow following steps
1.Right Click toolbarclick control box
2.From control box select a command button and draw it to your sheet
3.Double click the command button to open code window and paste following
codes
Private Sub CommandButton1_Click()
Dim row As Integer, col As Integer
row = 1
col = 1

Dim str1 As String

While Sheet1.Cells(row, col).Value < ""
str1 = Sheet1.Cells(row + 1, col).Value

Sheet1.Cells(row, col + 2).Value = str1

Sheet1.Rows(row + 1).Delete

row = row + 1
Wend
End Sub

Now on clicking the command button, you get the result


Have a nice time€¦.

Chris
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200902/1