UNABLE TO PUT IN A LOOP

  • Thread starter Thread starter ali
  • Start date Start date
A

ali

Hi GUYS ,

I am unable to put a loop for the following code. I like to cut values
from row 12 and paste them left of the values in row 9. I want to do
it until there is no value left in row 12. The following code does it
for one value only. Can we put some loop in it unless no value left in
row 12.

Dim LASTCOL As Integer
LASTCOL = Sheet1.Cells(12, Columns.Count).End(xlToLeft).Column
Sheet1.Cells(12, LASTCOL).Cut
Sheet1.Range("A9").Select
Selection.End(xlToRight).Select
Selection.Offset(0, -1).Select
ActiveSheet.Paste

thanks

ali
 
Sub test()

Dim LASTCOL As Integer

With Sheets("sheet1")
.Activate
LASTCOL = .Cells(12, Columns.Count). _
End(xlToLeft).Column
Set cutrange = Range(.Cells(12, "A"), _
.Cells(12, LASTCOL))
cutrange.Cut

.Cells(9, Columns.Count).End(xlToLeft).Select
Selection.Offset(0, 1).Select

ActiveSheet.Paste
End With
End Sub
 

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