VBA error

normpam

Active Member
Joined
Oct 30, 2002
Messages
360
Sub Jesse()
Range("C1").Select
Do Until Range(ActiveCell, ActiveCell).Value = "stop"
Range(ActiveCell, ActiveCell).Offset(1, 0).Select
Range(ActiveCell, ActiveCell).Offset(4, 0).Select
If Range(ActiveCell, ActiveCell).Value <> 4 Then Selection.EntireRow.Insert
Loop
End Sub


B C
Axelman, Norman #Value
1710 NE 170 Street #Value
Miami, FL 33162 #Value
Email #Value
305-323-1005 4
Gomer, G #Value
949 President St #Value
Brooklyn, NY #Value
Email #Value
Green, D #Value

Above is a sample of my data. The code I wrote starts at C1; moves down one cell, then moves down four rows. If the value of that cell equals '4', the code loops. Works perfectly until it moves down four rows and finds the text #Value. (this is actually text in the cell). but when it gets to this cell, instead of evaluating the cell as not being equal to '4' and inserting a row, I get a 'type mismatch' error 13.
Any ideas? Thanks!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Please note: when I posted the thread I separated columns B and C. The number 4 in the fifth row is really in col C, etc.
 
Upvote 0
Looks like I answered my own question just now.... if I change the text '#Value!' to 'something', then the code works. Why would #Value! - which I copied and pasted as text, mess up like this?
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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