Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro terminates with no error

The following macro just terminates after the line that say
"rng.EntireColumn.Hidden = False". That line seems to execut
correctly. There is no error of any kind displayed. Any idea why?

Code
-------------------

Sub name_fixup(old_name As String, new_name As String)
Dim rng As Range
Set rng = ActiveSheet.Range("H:L")
rng.EntireColumn.Hidden = False

Set c = rng.Find(old_name, LookIn:=xlValues, LookAt:=xlWhole)
While Not c Is Nothing
c.Value = new_name
Set c = rng.FindNext()
Wend
rng.EntireColumn.Hidden = True
End Sub

-------------------

The reason I am trying to do the unhide is that the Find fails if th
columns are hidden. Is there some way to make the Find search in hidde
columns? (Then I won't have to use the statements that are causin
problems.

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro terminates with no error

Sub tester2()
name_fixup "house", "cat"
End Sub


Sub name_fixup(old_name As String, new_name As String)
Dim rng As Range
Set rng = ActiveSheet.Range("H:L")
rng.EntireColumn.Hidden = False

Set c = rng.Find(old_name, LookIn:=xlValues, LookAt:=xlWhole)
While Not c Is Nothing
c.Value = new_name
Set c = rng.FindNext()
Wend
rng.EntireColumn.Hidden = True
End Sub



Worked fine for me. I didn't alter you code.

--
Regards,
Tom Ogilvy


"pH7 " wrote in message
...
The following macro just terminates after the line that says
"rng.EntireColumn.Hidden = False". That line seems to execute
correctly. There is no error of any kind displayed. Any idea why?

Code:
--------------------

Sub name_fixup(old_name As String, new_name As String)
Dim rng As Range
Set rng = ActiveSheet.Range("H:L")
rng.EntireColumn.Hidden = False

Set c = rng.Find(old_name, LookIn:=xlValues, LookAt:=xlWhole)
While Not c Is Nothing
c.Value = new_name
Set c = rng.FindNext()
Wend
rng.EntireColumn.Hidden = True
End Sub

--------------------

The reason I am trying to do the unhide is that the Find fails if the
columns are hidden. Is there some way to make the Find search in hidden
columns? (Then I won't have to use the statements that are causing
problems.)


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro terminates with no error

I found the answer to my second question and therefore the first proble
went away. Sorry, I didn't think to search for that first. If anyon
knows the answer to the first question, it would still be of interes
because I have had that sort of thing happen in other situations a
well

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro terminates with no error

The code works fine, so there was no reason to ask either question.

--
Regards,
Tom Ogilvy


"pH7 " wrote in message
...
I found the answer to my second question and therefore the first problem
went away. Sorry, I didn't think to search for that first. If anyone
knows the answer to the first question, it would still be of interest
because I have had that sort of thing happen in other situations as
well.


---
Message posted from http://www.ExcelForum.com/



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
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Autofilter, terminates after selecting "ALL" ufo_pilot Excel Discussion (Misc queries) 2 June 14th 06 04:17 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Visual Basic editor terminates Excel 2003 Jim Zeeb Excel Programming 3 January 30th 04 08:22 PM


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