Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default .Value 9999 not recognised

I'm using code from an example posted on Ron de Bruin's web site to delete
rows where the contents of column C equals 9999. However, this isn't
working which I assume is to do with column C being numeric, I've tried all
sorts but to no avail - any pointers welcome. Thanks, Rob
..........................


'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'We check the values in the A column in this example
With .Cells(Lrow, "A")
If Not IsError(.Value) Then
If .Value = 9999 Then .EntireRow.Delete
End If
End With
Next Lrow


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default .Value 9999 not recognised

Hi
Your code is checking column A, not column C. Change the "A" to a "C".
You also have things like .UsedRange, which suggests you need to wrap
your code inside something like

With worksheets("mysheet")
'your code
End with

Apart from that, the code looks fine.
regards
Paul

On Mar 11, 8:41*am, "Rob" wrote:
I'm using code from an example posted on Ron de Bruin's web site to delete
rows where the contents of column C equals 9999. *However, this isn't
working which I assume is to do with column C being numeric, I've tried all
sorts but to no avail - any pointers welcome. *Thanks, Rob
.........................

*'Set the first and last row to loop through
* * * * Firstrow = .UsedRange.Cells(1).Row
* * * * Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row

* * * * 'We loop from Lastrow to Firstrow (bottom to top)
* * * * For Lrow = Lastrow To Firstrow Step -1
* * * * * * 'We check the values in the A column in this example
* * * * * * With .Cells(Lrow, "A")
* * * * * * * * If Not IsError(.Value) Then
* * * * * * * * * * If .Value = 9999 Then .EntireRow..Delete
* * * * * * * * End If
* * * * * * End With
* * * * Next Lrow


  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default .Value 9999 not recognised

Sorry, but just sorted. 9999 was in a merged cell with another column!!!!


"Rob" wrote in message
...
I'm using code from an example posted on Ron de Bruin's web site to delete
rows where the contents of column C equals 9999. However, this isn't
working which I assume is to do with column C being numeric, I've tried
all sorts but to no avail - any pointers welcome. Thanks, Rob
.........................


'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'We check the values in the A column in this example
With .Cells(Lrow, "A")
If Not IsError(.Value) Then
If .Value = 9999 Then .EntireRow.Delete
End If
End With
Next Lrow




Reply
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
add time greater than 9999:56 PapaT Excel Worksheet Functions 2 March 28th 06 03:48 AM
Find value (31.12.9999) and clear Tempy Excel Programming 3 September 13th 05 01:22 AM
Replace first part of SS# with x's (XXXX-XX-9999) Jenpher Excel Programming 6 May 6th 04 05:02 AM
Name not recognised Jerome_t Excel Programming 5 April 23rd 04 06:10 PM
VBA code only working up to 9999 rows sup191[_17_] Excel Programming 4 April 2nd 04 10:06 PM


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

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

About Us

"It's about Microsoft Excel"