LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Code to delete rows giving mismatch error

Posted this two days ago but fear it has fallen by the wayside once off the
front page...

obs is taken from an inputbox and the msgbox returns the correct value.
Point of this is to go through the sheet row by row and delete any row where
column D does not equal twice the value of obs. I'm not completely familiar
with VBA and may well have screwed something up. "If cells (i,"D")..." line
is giving the mismatch error.

All help is much appreciated.


MsgBox "Obs value is = " & obs
For i = Cells(Rows.Count, "d").End(xlUp).Row To 2 Step -1
If Cells(i, "D") < obs * 2 Then Cells(i, "D").EntireRow.Delete
Next i
Range("D1:D65536").Select
Selection.Delete



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
VBA code to delete rows Secret Squirrel Excel Discussion (Misc queries) 3 January 21st 07 03:01 PM
[Q] Save As throws type mismatch error in control's code? Jason Weiss Excel Discussion (Misc queries) 1 July 16th 05 04:21 AM
code to delete rows ianalexh Excel Discussion (Misc queries) 5 May 5th 05 10:46 AM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"