How to arrange multiple cell value into single column

  • Thread starter Thread starter geniusideas
  • Start date Start date
G

geniusideas

For Example:
Before
A B C D
1 Button1 Button2
2 Button3 Button4
3 Button5 Button6
Button7

After
A
1 Button1
2 Button2
3 Button3
4 Button4
5 Button5
6 Button6
7 Button7

Pls help in VBA code how to do?
 
try:
Sub test()
Dim mycell As Range
Dim k As ingeter
Application.ScreenUpdating = False
On Error GoTo handle:
For Each mycell In ActiveSheet.UsedRange
If Not IsEmpty(mycell) Then
k = k + 1
mycell.Copy Cells(k, 5)
End If
Next mycell
handle:
Application.ScreenUpdating = True
End Sub
 
sorry ,write a wrong word
Dim k As ingeter
shd change
Dim k as integer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top