Help with some 'Offset' code

dcumming

New Member
Joined
Oct 1, 2012
Messages
1
Hopefully a simple one. I'm trying to work out what criteria stops this bit of code.
My understanding ov VBA is pretty basic.....

So,
In the MSP Data worksheet, from cell C4 - it's looking for 0 data then moving to another cell.
Basically - what's it doing in terms of moving and why is it stopping (as i'd expect it to go to the end of the column, which it isn't)

Thanks for any help
david




Sheets("MSP Data").Activate
Range("C4").Select
While Not ActiveCell.Offset(0, 0) = ""
If (ActiveCell.Offset(0, 1) = 0) Then
If (Not (ActiveCell.Offset(0, 1) > ActiveCell.Offset(-1, 1))) Then
ActiveCell.Offset(0, 2) = ActiveCell.Offset(-1, 2)
ActiveCell.Offset(0, 3) = ActiveCell.Offset(-1, 3)
ActiveCell.Offset(0, 4) = ActiveCell.Offset(-1, 4)
ActiveCell.Offset(0, 5) = ActiveCell.Offset(-1, 5)
ActiveCell.Offset(0, 6) = ActiveCell.Offset(-1, 6)
ActiveCell.Offset(0, 13) = ActiveCell.Offset(-1, 13)
ActiveCell.Offset(0, -1) = ActiveCell.Offset(-1, -1)
ActiveCell.Offset(0, 0) = ActiveCell.Offset(-1, 0)
End If
End If
ActiveCell.Offset(1, 0).Select
Wend

End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
It's moving down column C starting at row 4.

Why is it stopping early?

Hard to tell but the code can change the value in column C as it goes.

This puts the value from column B one cell up from ActiveCell into the cell below, it then puts that value in column ActiveCell.
Code:
ActiveCell.Offset(0, -1) = ActiveCell.Offset(-1, -1)
 ActiveCell.Offset(0, 0) = ActiveCell.Offset(-1, 0)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,267
Messages
6,129,792
Members
449,535
Latest member
Piaskun

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