Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Object Required Error

Hi All,

I have written the code below and can see no reason for it not to
work, however when I run the code I get an error saying "Object
Required" I don't understand why I am seeing this error, however if i
change cell.entirerow.delete to cell.interior.color=vbBlue then the
code will run fine.
Can anybody offer any suggestions?

Sub A_1_Macro()
'UserForm1.Show

Application.ScreenUpdating = False

For x = 0 To 4

For Each cell In Range("A1:A35000")

If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If

If Mid(cell, 1, 18) = "CR INFO: Executing" Then
cell.EntireRow.delete
End If

If cell.Value = "MADD - SARM exception statistics" Then
cell.EntireRow.delete
End If

If cell.Value = "Terminated from far-end" Then
cell.EntireRow.delete
End If

Next cell

Next x

Call A_2_DeleteRows

End Sub

Many Thanks,
Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Object Required Error

Hi Mark,

Just guessing your achievement is identify cell which containing:
"CR INFO: Executing, 0,MADD - SARM exception statistics,Terminated from
far-end"

so you can use it:

Sub A_1_Macrox()
Dim Strx, cell As Range, x As Integer
Strx = Split("CR INFO: Executing, 0,MADD - SARM exception
statistics,Terminated from far-end", ",")

For x = 0 To UBound(Strx)
For Each cell In Range("A1:A500")
If InStr(1, cell, Strx(x)) Then cell.EntireRow.Delete
Next cell
Next x

End Sub
--

Regards,

Halim


"MarkHear1" wrote:

Hi All,

I have written the code below and can see no reason for it not to
work, however when I run the code I get an error saying "Object
Required" I don't understand why I am seeing this error, however if i
change cell.entirerow.delete to cell.interior.color=vbBlue then the
code will run fine.
Can anybody offer any suggestions?

Sub A_1_Macro()
'UserForm1.Show

Application.ScreenUpdating = False

For x = 0 To 4

For Each cell In Range("A1:A35000")

If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If

If Mid(cell, 1, 18) = "CR INFO: Executing" Then
cell.EntireRow.delete
End If

If cell.Value = "MADD - SARM exception statistics" Then
cell.EntireRow.delete
End If

If cell.Value = "Terminated from far-end" Then
cell.EntireRow.delete
End If

Next cell

Next x

Call A_2_DeleteRows

End Sub

Many Thanks,
Mark


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Object Required Error

On 24 Apr, 11:12, Halim wrote:
Hi Mark,

Just guessing your achievement is identify cell which containing:
"CR INFO: Executing, 0,MADD - SARM exception statistics,Terminated from
far-end"

so you can use it:

Sub A_1_Macrox()
Dim Strx, cell As Range, x As Integer
Strx = Split("CR INFO: Executing, 0,MADD - SARM exception
statistics,Terminated from far-end", ",")

For x = 0 To UBound(Strx)
For Each cell In Range("A1:A500")
If InStr(1, cell, Strx(x)) Then cell.EntireRow.Delete
Next cell
Next x

End Sub
--

Regards,

Halim



"MarkHear1" wrote:
Hi All,


I have written the code below and can see no reason for it not to
work, however when I run the code I get an error saying "Object
Required" I don't understand why I am seeing this error, however if i
change cell.entirerow.delete to cell.interior.color=vbBlue then the
code will run fine.
Can anybody offer any suggestions?


Sub A_1_Macro()
'UserForm1.Show


Application.ScreenUpdating = False


For x = 0 To 4


For Each cell In Range("A1:A35000")


If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If


If Mid(cell, 1, 18) = "CR INFO: Executing" Then
cell.EntireRow.delete
End If


If cell.Value = "MADD - SARM exception statistics" Then
cell.EntireRow.delete
End If


If cell.Value = "Terminated from far-end" Then
cell.EntireRow.delete
End If


Next cell


Next x


Call A_2_DeleteRows


End Sub


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


Halim,

Thank you for your suggestion, but can anybody offer an suggestions as
to why my code is not working?

Thanks,

Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Object Required Error

On 24 Apr, 11:12, Halim wrote:
Hi Mark,

Just guessing your achievement is identify cell which containing:
"CR INFO: Executing, 0,MADD - SARM exception statistics,Terminated from
far-end"

so you can use it:

Sub A_1_Macrox()
Dim Strx, cell As Range, x As Integer
Strx = Split("CR INFO: Executing, 0,MADD - SARM exception
statistics,Terminated from far-end", ",")

For x = 0 To UBound(Strx)
For Each cell In Range("A1:A500")
If InStr(1, cell, Strx(x)) Then cell.EntireRow.Delete
Next cell
Next x

End Sub
--

Regards,

Halim



"MarkHear1" wrote:
Hi All,


I have written the code below and can see no reason for it not to
work, however when I run the code I get an error saying "Object
Required" I don't understand why I am seeing this error, however if i
change cell.entirerow.delete to cell.interior.color=vbBlue then the
code will run fine.
Can anybody offer any suggestions?


Sub A_1_Macro()
'UserForm1.Show


Application.ScreenUpdating = False


For x = 0 To 4


For Each cell In Range("A1:A35000")


If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If


If Mid(cell, 1, 18) = "CR INFO: Executing" Then
cell.EntireRow.delete
End If


If cell.Value = "MADD - SARM exception statistics" Then
cell.EntireRow.delete
End If


If cell.Value = "Terminated from far-end" Then
cell.EntireRow.delete
End If


Next cell


Next x


Call A_2_DeleteRows


End Sub


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


Thank you for your suggestion Halim.

However, can anybody please offer any suggestions as to why the code I
posted didn't work?

Thanks,

Mark

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Object Required Error

Mark,

1. You can run your macro in debug mode by pressing F8 in your sub
so you can found the error line highlighted yellow
2. and check whether sub A_2_DeleteRows is available in your project...
--

Regards,

Halim


"MarkHear1" wrote:

On 24 Apr, 11:12, Halim wrote:
Hi Mark,

Just guessing your achievement is identify cell which containing:
"CR INFO: Executing, 0,MADD - SARM exception statistics,Terminated from
far-end"

so you can use it:

Sub A_1_Macrox()
Dim Strx, cell As Range, x As Integer
Strx = Split("CR INFO: Executing, 0,MADD - SARM exception
statistics,Terminated from far-end", ",")

For x = 0 To UBound(Strx)
For Each cell In Range("A1:A500")
If InStr(1, cell, Strx(x)) Then cell.EntireRow.Delete
Next cell
Next x

End Sub
--

Regards,

Halim



"MarkHear1" wrote:
Hi All,


I have written the code below and can see no reason for it not to
work, however when I run the code I get an error saying "Object
Required" I don't understand why I am seeing this error, however if i
change cell.entirerow.delete to cell.interior.color=vbBlue then the
code will run fine.
Can anybody offer any suggestions?


Sub A_1_Macro()
'UserForm1.Show


Application.ScreenUpdating = False


For x = 0 To 4


For Each cell In Range("A1:A35000")


If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If


If Mid(cell, 1, 18) = "CR INFO: Executing" Then
cell.EntireRow.delete
End If


If cell.Value = "MADD - SARM exception statistics" Then
cell.EntireRow.delete
End If


If cell.Value = "Terminated from far-end" Then
cell.EntireRow.delete
End If


Next cell


Next x


Call A_2_DeleteRows


End Sub


Many Thanks,
Mark- Hide quoted text -


- Show quoted text -


Thank you for your suggestion Halim.

However, can anybody please offer any suggestions as to why the code I
posted didn't work?

Thanks,

Mark




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Object Required Error

I think you are doing something like this:


Sub NoObject()

Set cell = Cells(1, 1)
cell.Value = "some value"

MsgBox cell.Value

Cells(1, 1).EntireRow.Delete

'you get an error here because
'you've just deleted the cell
'you are trying to use

MsgBox cell.Value

End Sub


If one of your ifs is succesful:

If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If

cell gets deleted, but you try to use it in the next if:

If Mid(cell, 1, 18) = "CR INFO: Executing" Then ...



You can try Halim's suggestion or to combine your ifs into one:


If Mid(cell, 26, 2) = " 0" Or _
Mid(cell, 1, 18) = "CR INFO: Executing" Or _
cell.Value = "MADD - SARMA exception statistics" Or _
cell.Value = "Terminated from far-end" Then
'do something
End If



--
urkec

Thank you for your suggestion Halim.

However, can anybody please offer any suggestions as to why the code I
posted didn't work?

Thanks,

Mark


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Object Required Error

On 24 Apr, 13:54, urkec wrote:
I think you are doing something like this:

Sub NoObject()

Set cell = Cells(1, 1)
cell.Value = "some value"

MsgBox cell.Value

Cells(1, 1).EntireRow.Delete

'you get an error here because
'you've just deleted the cell
'you are trying to use

MsgBox cell.Value

End Sub

If one of your ifs is succesful:

If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If

cell gets deleted, but you try to use it in the next if:

If Mid(cell, 1, 18) = "CR INFO: Executing" Then ...

You can try Halim's suggestion or to combine your ifs into one:

If Mid(cell, 26, 2) = " 0" Or _
Mid(cell, 1, 18) = "CR INFO: Executing" Or _
cell.Value = "MADD - SARMA exception statistics" Or _
cell.Value = "Terminated from far-end" Then
'do something
End If

--
urkec



Thank you for your suggestion Halim.


However, can anybody please offer any suggestions as to why the code I
posted didn't work?


Thanks,


Mark- Hide quoted text -


- Show quoted text -


Urkec,

Thank you, that makes sense now, i obviously lack common sense as well
as VBA Knowledge! :-p

Thanks Again,

Mark

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 256
Default Object Required Error

Sub A_1_Macro()
Dim myCell as Excel.Range
Dim myRange as Excel.Range

set myRange = ActiveSheet.Range("A1:A35000")

for each myCell in myRange

' your code

next myCell

set myCell = Nothing
set myRange = Nothing
end sub

On Apr 24, 5:26 am, MarkHear1 wrote:
Hi All,

I have written the code below and can see no reason for it not to
work, however when I run the code I get an error saying "Object
Required" I don't understand why I am seeing this error, however if i
change cell.entirerow.delete to cell.interior.color=vbBlue then the
code will run fine.
Can anybody offer any suggestions?

Sub A_1_Macro()
'UserForm1.Show

Application.ScreenUpdating = False

For x = 0 To 4

For Each cell In Range("A1:A35000")

If Mid(cell, 26, 2) = " 0" Then
cell.EntireRow.delete
End If

If Mid(cell, 1, 18) = "CR INFO: Executing" Then
cell.EntireRow.delete
End If

If cell.Value = "MADD - SARM exception statistics" Then
cell.EntireRow.delete
End If

If cell.Value = "Terminated from far-end" Then
cell.EntireRow.delete
End If

Next cell

Next x

Call A_2_DeleteRows

End Sub

Many Thanks,
Mark



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
Object required error 424 why getting? Chet Excel Programming 2 April 6th 07 07:26 PM
Object Required Error 424 Jason Excel Programming 2 December 28th 05 10:27 PM
Error 424 - Object Required [email protected] Excel Programming 2 December 30th 04 03:38 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
error 424 - Object Required blb Excel Programming 0 October 1st 03 05:32 PM


All times are GMT +1. The time now is 07:20 AM.

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"