LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Runtime 1004 unable to get find property of range class

2 macros that are identical & in same module. They just look for different text within cells. Find " Apt" works great.
Find " #" returns Runtime 1004, unable to get find property of range class. Does anyone know what is going on? It also returns the error if I change the value I'm searching for and chane c to rng or anything else.


Sub Remove_AptNum()
Dim firstaddress As Variant
With Worksheets(1).Range("D:D")
Set c = .Find(what:=" Apt", LookIn:=xlValues)

If Not c Is Nothing Then
firstaddress = c.Address
Do
c.Offset(0, 1).Select
Selection.Value = Right(c, Len(c) - Application.WorksheetFunction.Search(" Apt", (c)))
c.Value = Left(c, Application.WorksheetFunction.Search(" Apt", c) - 1)

Set c = .FindNext(c)

If c Is Nothing Then Exit Do
Loop While Not c Is Nothing And c.Address < firstaddress
End If

End With
Set c = Nothing
End Sub

Sub remove_Numbersign()
Dim firstaddress As Variant
With Worksheets(1).Range("D:D")
Set c = .Find(what:=" #", LookIn:=x1Values)

If Not rng Is Nothing Then
firstaddress = b.Address
Do
rng.Offset(0, 1).Select
Selection.Value = Right(c, Len(c) - Application.WorksheetFunction.Search(" #", (c)))
rng.Value = Left(c, Application.WorksheetFunction.Search(" #", c) - 1)

Set rng = .FindNext(c)

If c Is Nothing Then Exit Do
Loop While Not c Is Nothing And c.Address < firstaddress
End If
End With
Set rng = Nothing
End Sub
 
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
Runtime Error 1004 Unable to set the top property of the picture c JB Bates[_2_] Excel Discussion (Misc queries) 1 March 3rd 10 08:04 PM
Runtime 1004 error -- insert method of range class failed. tish Excel Discussion (Misc queries) 1 June 1st 07 04:04 PM
excel97: runtime error 1004 select method of range class failed JMCN Excel Programming 4 December 25th 03 05:32 AM
Run-time error '1004' - Unable to set the Visible property of the Worksheet class Shalin Chopra Excel Programming 3 November 25th 03 08:38 PM
Unable to set the Locked Property of the Range Class Stuart[_5_] Excel Programming 0 July 15th 03 06:59 PM


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