#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default dim problem

Because I am not real skilled at this, I understand what Option Explicit
means and that I have to dim certain pieces of code .. I do not know what to
dim as I'm getting an error for the rw in this code. Can someone help me
with this?
_____________________
set rw = cells(rows.count,"F").End(xlup)

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _

"DRI2","DRI3", "DRIA", "DRIB")

for i = rw to 1 step -1

res = Application.Match(cells(rw,"F").Value,list,0)

if not iserror(res) then

cells(rw,"F").EntireRow.delete

end if

Next




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default dim problem

Hi,
Dim rw As Range

HTH--Lonnie M.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default dim problem

And

Dim i As Long
Dim list As Variant
Dim res As Variant

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lonnie M." wrote in message
oups.com...
Hi,
Dim rw As Range

HTH--Lonnie M.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default dim problem

grrrr .. still not working with all this helpful information ... here's the
code with the additives:

Dim i As Long
Dim list As Variant
Dim res As Variant
Dim rw As Range

rw = Cells(Rows.Count, "F").End(xlUp).Row
Set rw = Cells(Rows.Count, "F").End(xlUp)
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next

"Bob Phillips" wrote in message
...
And

Dim i As Long
Dim list As Variant
Dim res As Variant

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lonnie M." wrote in message
oups.com...
Hi,
Dim rw As Range

HTH--Lonnie M.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default dim problem

Hi Annette,

Try:

Sub Tester()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant

rw = Cells(Rows.Count, "F").End(xlUp).Row

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")

For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next
End Sub



---
Regards,
Norman



"Annette" wrote in message
...
grrrr .. still not working with all this helpful information ... here's
the
code with the additives:

Dim i As Long
Dim list As Variant
Dim res As Variant
Dim rw As Range

rw = Cells(Rows.Count, "F").End(xlUp).Row
Set rw = Cells(Rows.Count, "F").End(xlUp)
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next

"Bob Phillips" wrote in message
...
And

Dim i As Long
Dim list As Variant
Dim res As Variant

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lonnie M." wrote in message
oups.com...
Hi,
Dim rw As Range

HTH--Lonnie M.









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default dim problem

Hi Annette,

In addition to Bob's response,

Dim rw As Long

Also, change:

set rw = cells(rows.count,"F").End(xlup)


to

rw = Cells(Rows.Count, "F").End(xlUp).Row


---
Regards,
Norman



"Annette" wrote in message
...
Because I am not real skilled at this, I understand what Option Explicit
means and that I have to dim certain pieces of code .. I do not know what
to
dim as I'm getting an error for the rw in this code. Can someone help me
with this?
_____________________
set rw = cells(rows.count,"F").End(xlup)

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _

"DRI2","DRI3", "DRIA", "DRIB")

for i = rw to 1 step -1

res = Application.Match(cells(rw,"F").Value,list,0)

if not iserror(res) then

cells(rw,"F").EntireRow.delete

end if

Next






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default dim problem

Followed all the suggested and still getting an error so I'm copying with
all the past changes from your suggestions ... I know this can work, just
that I'm too dumb to know how to do:

Sub undistributed()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant
rw = Cells(Rows.Count, "F").End(xlUp).Row
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next
End Sub

"Norman Jones" wrote in message
...
Hi Annette,

In addition to Bob's response,

Dim rw As Long

Also, change:

set rw = cells(rows.count,"F").End(xlup)


to

rw = Cells(Rows.Count, "F").End(xlUp).Row


---
Regards,
Norman



"Annette" wrote in message
...
Because I am not real skilled at this, I understand what Option Explicit
means and that I have to dim certain pieces of code .. I do not know

what
to
dim as I'm getting an error for the rw in this code. Can someone help

me
with this?
_____________________
set rw = cells(rows.count,"F").End(xlup)

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _

"DRI2","DRI3", "DRIA", "DRIB")

for i = rw to 1 step -1

res = Application.Match(cells(rw,"F").Value,list,0)

if not iserror(res) then

cells(rw,"F").EntireRow.delete

end if

Next








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default dim problem

oops ... is not an error .. just doesn't do anything ... no errors .. just
doesn't perform.

"Annette" wrote in message
...
Followed all the suggested and still getting an error so I'm copying with
all the past changes from your suggestions ... I know this can work, just
that I'm too dumb to know how to do:

Sub undistributed()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant
rw = Cells(Rows.Count, "F").End(xlUp).Row
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next
End Sub

"Norman Jones" wrote in message
...
Hi Annette,

In addition to Bob's response,

Dim rw As Long

Also, change:

set rw = cells(rows.count,"F").End(xlup)


to

rw = Cells(Rows.Count, "F").End(xlUp).Row


---
Regards,
Norman



"Annette" wrote in message
...
Because I am not real skilled at this, I understand what Option

Explicit
means and that I have to dim certain pieces of code .. I do not know

what
to
dim as I'm getting an error for the rw in this code. Can someone help

me
with this?
_____________________
set rw = cells(rows.count,"F").End(xlup)

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _

"DRI2","DRI3", "DRIA", "DRIB")

for i = rw to 1 step -1

res = Application.Match(cells(rw,"F").Value,list,0)

if not iserror(res) then

cells(rw,"F").EntireRow.delete

end if

Next










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default dim problem

Assuming you've got the right worksheet active, it looks like the Match
function is not finding the value of Cells(rw,"F") in the array; add,
after res=Application.Match etc. the line
MsgBox res
to see what value is in that cell and whether it is a value that is in
the list.

By the way, your loop isn't doing anything except looking for a value is
the same place every iteration--changing the i counter isn't changing
the code that's executed, which is independent of i. Perhaps you meant

Application.Match(Cells(i,"F").Value

Alan Beban

Annette wrote:
oops ... is not an error .. just doesn't do anything ... no errors .. just
doesn't perform.

"Annette" wrote in message
...

Followed all the suggested and still getting an error so I'm copying with
all the past changes from your suggestions ... I know this can work, just
that I'm too dumb to know how to do:

Sub undistributed()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant
rw = Cells(Rows.Count, "F").End(xlUp).Row
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next
End Sub

"Norman Jones" wrote in message
...

Hi Annette,

In addition to Bob's response,

Dim rw As Long

Also, change:


set rw = cells(rows.count,"F").End(xlup)

to

rw = Cells(Rows.Count, "F").End(xlUp).Row


---
Regards,
Norman



"Annette" wrote in message
...

Because I am not real skilled at this, I understand what Option


Explicit

means and that I have to dim certain pieces of code .. I do not know


what

to
dim as I'm getting an error for the rw in this code. Can someone help


me

with this?
_____________________
set rw = cells(rows.count,"F").End(xlup)

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _

"DRI2","DRI3", "DRIA", "DRIB")

for i = rw to 1 step -1

res = Application.Match(cells(rw,"F").Value,list,0)

if not iserror(res) then

cells(rw,"F").EntireRow.delete

end if

Next









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default dim problem

Hi Annette, I think you want to replace the rw's with in your loop with
"i":

Sub undistributed()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant
rw = Cells(Rows.Count, "F").End(xlUp).Row
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(i, "F").Value, list, 0)
If Not IsError(res) Then
Cells(i, "F").EntireRow.Delete
End If
Next
End Sub

HTH--Sorry about giving you the wrong variable type for rw above, I
must have still been dazed from lunch--Lonnie M.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default dim problem

Okay .. IT's A WORKING (sorry bout the hollerin) but it is working backwards
.... deleting the wrong ones instead of leaving those, but you know what, I
don't care and I'll work with it as is ... I like ... thanks to everyone who
piped in with great answers!


  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default dim problem

Annette,
If you want it to delete those that match your list try this:

For i = rw To 1 Step -1
res = Application.Match(Cells(i, "F").Value, list, 0)
If IsError(res) Then
Cells(i, "F").EntireRow.Delete
End If
Next
End

Good Luck!

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default dim problem

Annette,
If you want it to delete those that don't match your list try this:


For i = rw To 1 Step -1
res = Application.Match(Cells(i, "F").Value, list, 0)
If IsError(res) Then
Cells(i, "F").EntireRow.Delete
End If
Next
End


Good Luck!

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default dim problem

Hi Annette,

The last two instances of rw should be i

Try this amended version:

Sub undistributed()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant

With Sheets("Sheet1") '<<======= CHANGE TO SUIT
rw = .Cells(Rows.Count, "F").End(xlUp).Row
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(.Cells(i, "F").Value, list, 0)
If Not IsError(res) Then
.Cells(i, "F").EntireRow.Delete
End If
Next
End With
End Sub


Change Sheet1 to your sheet name.

---
Regards,
Norman



"Annette" wrote in message
...
Followed all the suggested and still getting an error so I'm copying with
all the past changes from your suggestions ... I know this can work, just
that I'm too dumb to know how to do:

Sub undistributed()
Dim rw As Long
Dim i As Long
Dim res As Variant
Dim list As Variant
rw = Cells(Rows.Count, "F").End(xlUp).Row
list = Array("DRH1", "DRH2", "DRH3", "DRI1", _
"DRI2", "DRI3", "DRIA", "DRIB")
For i = rw To 1 Step -1
res = Application.Match(Cells(rw, "F").Value, list, 0)
If Not IsError(res) Then
Cells(rw, "F").EntireRow.Delete
End If
Next
End Sub

"Norman Jones" wrote in message
...
Hi Annette,

In addition to Bob's response,

Dim rw As Long

Also, change:

set rw = cells(rows.count,"F").End(xlup)


to

rw = Cells(Rows.Count, "F").End(xlUp).Row


---
Regards,
Norman



"Annette" wrote in message
...
Because I am not real skilled at this, I understand what Option
Explicit
means and that I have to dim certain pieces of code .. I do not know

what
to
dim as I'm getting an error for the rw in this code. Can someone help

me
with this?
_____________________
set rw = cells(rows.count,"F").End(xlup)

list = Array("DRH1", "DRH2", "DRH3", "DRI1", _

"DRI2","DRI3", "DRIA", "DRIB")

for i = rw to 1 step -1

res = Application.Match(cells(rw,"F").Value,list,0)

if not iserror(res) then

cells(rw,"F").EntireRow.delete

end if

Next










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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 02:36 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"