Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default runtime error 13 - unlucky for some!


afternoon!

this has been bugging me for ages!

am not excellent in vba so please be nice!!

i have a spreadsheet of about 1500 lines and would like to (using
macro) strip out all the records i don't need based a value in one o
the columns.

for example:

column b holds the name of the programme and i only want projects wit
a programme name of either zmxxxx or zmyyyy. the macro i am tryin
(and failing)to write would look at the value of b1, evaluate it an
delete it if it didn't match either zmxxxx or zmyyyy.

the code:

Sub tidy_up()

Const workstream1 As String = "zmxxx"
Const workstream2 As String = "myyyy

Dim project As String

project = activecell

If CStr(project) < CStr(workstream1) Or CStr(workstream2) Then

activecell.EntireRow.Delete

Else

End If

End Sub

i keep getting run time error 13 appear. i can't see where the proble
is as everything matches (as far as my very untrained eye can see!)

please can anyone out there in cyberland help as i have a big dent i
my head from banging it against my desk!

TIA,

MoonWeaze

--
MoonWeaze
-----------------------------------------------------------------------
MoonWeazel's Profile: http://www.excelforum.com/member.php...nfo&userid=211
View this thread: http://www.excelforum.com/showthread.php?threadid=47878

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default runtime error 13 - unlucky for some!

MW,

Computers are dumb, you have to tell them what to do.<g

"Or CStr(workstream2)" has to stand by itself without assuming
that Excel should know the comparison you want to make.
Also your variables are declared as Strings, so they don't need to be
converted to strings later. Give this a try...
(note the change from "or" to "and")
'--------------------
Sub tidy_up()
Const workstream1 As String = "zmxxx"
Const workstream2 As String = "myyyy"
Dim project As String

project = CStr(ActiveCell.Value)
If project < workstream1 And project < workstream2 Then
ActiveCell.EntireRow.Delete
End If
End Sub
'------------------
Jim Cone
San Francisco, USA



MoonWeazel" wrote...
afternoon!
this has been bugging me for ages!
am not excellent in vba so please be nice!!
i have a spreadsheet of about 1500 lines and would like to (using a
macro) strip out all the records i don't need based a value in one of
the columns.
for example:
column b holds the name of the programme and i only want projects with
a programme name of either zmxxxx or zmyyyy. the macro i am trying
(and failing)to write would look at the value of b1, evaluate it and
delete it if it didn't match either zmxxxx or zmyyyy.
the code:

Sub tidy_up()

Const workstream1 As String = "zmxxx"
Const workstream2 As String = "myyyy

Dim project As String

project = activecell

If CStr(project) < CStr(workstream1) Or CStr(workstream2) Then

activecell.EntireRow.Delete

Else

End If

End Sub

i keep getting run time error 13 appear. i can't see where the problem
is as everything matches (as far as my very untrained eye can see!)
please can anyone out there in cyberland help as i have a big dent in
my head from banging it against my desk!

TIA,
MoonWeazel
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default runtime error 13 - unlucky for some!


Hey Jim!

Cool and groovy dude!

well impressed!

so close yet so far!

you saved my poor head and my poor desk!

laters!

moonweazel!


--
MoonWeazel
------------------------------------------------------------------------
MoonWeazel's Profile: http://www.excelforum.com/member.php...fo&userid=2119
View this thread: http://www.excelforum.com/showthread...hreadid=478780

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
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
naming tab macro error runtime error 1004 D Excel Programming 3 February 28th 05 01:32 AM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


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