Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following incomplete macro, where a user selects a range.
We then loop through the range going thru each column in first row of range then down to next row and across each column etc. etc. When I hit a cell who's value is 0, it want to take that value and place it in a cell offset from the active cell inside for loop. The column offset will come from current row (in for loop) and column b. The row offset i would envision as being some constant value let say 10 for arguments sake. For example, let say my selected range is C2:M10 My first cell within range 0 is H2 In cell B2 lets say it's 4 Now we want to take the value from H2 and place it in D12 (the 4 in B2 will offset the active cell by 4 columns to the left and the constant 10 offset the rows from active cell by 10. The for loop will then continue until we hit the next cell 0. Assuming we are still on row 2 the offset value for columns remains B2, but once we loop to next row the offset for column would be B3 etc etc. In the code below i'm having difficulty putting into code what i describe above, hopefully someone can help. Sub Test() Dim row As Range Dim cell As Range Dim UserRange1 As Range On Error GoTo Canceled Set UserRange1 = Application.InputBox(Prompt:="Please Select Range", Title:="Range Select", Type:=8) For Each row In UserRange1.Rows For Each cell In row.Cells If cell 0 Then this is where i came unstuck........... End If Next cell Next row Canceled: End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy (A2:A26) paste, offset one cell, do it again. Loop 256 tim | Excel Programming | |||
move from active cell offset in macro | Excel Discussion (Misc queries) | |||
Offset of active cell | Excel Programming | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Worksheet Functions | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Programming |