Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
One more variations on this theme : '---------------------------------- Sub test() Dim LastRow As Long Dim Rg As Range, R As Range With Worksheets("Sheet1") 'Adapte name sheet LastRow = .Range("C:H").Find(What:="*", _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious).Row Set Rg = .Range("C2:H" & LastRow) End With For Each R In Rg.Rows MySort R Next End Sub '---------------------------------- Sub MySort(R As Range) With R .Sort Key1:=R(1), Order1:=xlAscending, _ Header:=xlNo, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlLeftToRight End With End Sub '---------------------------------- "SeanF74" a écrit dans le message de groupe de discussion : ... I have a list of 10,000 lines of data starting from row 2 in Excel 2007. I would like to select a range of cells from each line individually (columns C through L) for each of the 10k lines and sort horizontally. I am trying to use a do loop to do this, but I cannot set the range correctly with a variable (say c) to create a dynamic range. Here is a simplified view of what I have: c = 2 Do While c < 15000 Range("C2:L2").Select c = c +1 Loop What syntax do I use in the Range.Select argument using the c variable to move down a line each time I run through the Do Loop? Thanks, |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compile Errors in Excel VBasic | Excel Programming | |||
'spin buttons' & vbasic language | Excel Discussion (Misc queries) | |||
Selecting a range by using a loop | Excel Programming | |||
resetting Public Arrays in VBASIC | Excel Programming | |||
Formula in VBasic | Excel Discussion (Misc queries) |