Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ali ali is offline
external usenet poster
 
Posts: 22
Default UNABLE TO PUT IN A LOOP

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default UNABLE TO PUT IN A LOOP

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



"ali" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to click on charts & unable to create any new charts Excel Snapclick Charts and Charting in Excel 4 February 1st 09 07:59 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Loop Function unable to loop Junior728 Excel Programming 1 July 28th 05 10:23 AM


All times are GMT +1. The time now is 09:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"