From last to first column

excelis

New Member
Joined
Jun 3, 2010
Messages
38
Dear all,

I have a macro that runs by comparing the minimum values of every row and every row it given with a variant "h". In the comparison sometimes it is needed that, after it looks if the conditions are met on the last column, to see what happens in the first column.

In other words if my range is from column B to Y and for example it is addressed as follows:

Range("B" & h & ":Y" & h)

how and what should i write to say that after Y column consider B column and its values as if it is the next one (Z column)and the other way round( before B consider Y column)?

Thank you in advance!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You didn't say specifically what you are trying to accomplish so:

Code:
If Range("Y" & h) = "whatever" Then
    If Range("B" & h) = "whatever" Then
        'Your Code Here...
    End If
End If
 
Upvote 0
I am sorry if i was not clear. What i am trying to do is move my active cell according to large number of conditions which are expressed by "case" and "if" statements and they depend on the position in column of the minimum value of the row bellow my active cell and the one after.

So in other words what it does the macro is that ,if we say that my active cell is in the 3rd row, it checks where is the minimum value in row 4?what is the distance from my active cell in terms of column? where is the minimum value in row 5?what is the distance from my active cell in terms of column in this case?and then it sees which condition is met and moves accordingly my active cell in the positions ActiveCell.Offset(1,0)
ActiveCell.Offset(1,1)
ActiveCell.Offset(1,-1)

What i want to do is that if we say my active cell is in the cell Y3 and the minimum value of the two next rows in B4 and C5 to consider that the distance in terms of columns is not as 23 and 24 as in reality but as if it is 1 and 2. I want the whole table to be something like circular.

Is that possible??

Thank you for your answer!
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top