Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a code that loops on selected range ex. A1:B4.. the looping
starts from A1:B1 then it goes on the second row that is A2:B2 (it starts from left to right and goes on the second row)...Now my question is, would there be a way VBA to know when it starts to process a new row like A3:B3? Here's my code: What I want to do is for it to be smart enought to populate values at the start of every new row based on the range. I appreciate any help... For Each r In Sheets(5).Range(A1:B4).Cells If (I want that piece of code entered here, if there is) Then xlapp.ActiveWorkbook.Worksheets(4).Select Range("A1").Select Do Until IsEmpty(ActiveCell.Offset(x, 0)) x = x + 1 Loop n = 1 End If i = 0 sArray = Split(r & "ý", "ý") With xlapp .ActiveWorkbook.Worksheets(4).Select last = UBound(sArray) - 1 Do Until i last Cells(i + 1 + x, n).FormulaR1C1 = CStr(sArray(i)) i = i + 1 Loop .ActiveWorkbook.Worksheets(5).Select End With n = n + 1 'Next t 't = t + 1 Next r |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
LOOPING multiple ranges | Excel Discussion (Misc queries) | |||
Looping through dynamic ranges from multiple worksheets | Excel Programming | |||
Looping through named ranges | Excel Programming | |||
Any easier way than looping on ranges | Excel Programming | |||
Looping in Excel XP with C# -- Ranges and SpecialCells | Excel Programming |