LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default For Each Loop not working properly

Pardon me for jumping in...

Add this line:
msgbox "****" & Unit.Offset(0, 1).Value & "****"
Right before this line:
Set sh = Worksheets(Unit.Offset(0, 1).Value)

The asterisks are there just to help you know where the real value starts and
stops.

Now look at what is between those asterisks.

Do you have a worksheet by that name in that workbook?

I'm betting that you have one close, but not quite the same--a rogue space
character in front, at the end or doubled up inside.

Or just a complete typing mistake???


oakman wrote:

Hello Tom,

Thank you for still paying attention to my request for help. I have
entered the midified code. However, I get a different error for the
same line. I get error '9' "Subscript out of range". When I debug,
the line "Set sh = Worksheets(Unit.Offset(0, 1).Value)" is highlited in
yellow. I will be honest with you, I have no idea what this error
means. I REALLY wish that I could be more useful in to your effort to
help me. May I ask one question? Why is it that the macro assigns the
value to the "sh" variable the value of the data one column to the right
of the Unit names? Do you think this could be contributing to the line
of code being so problematic? Please disregard my ignorance if this
question is not relevant. I appreciate the fact that you have helped
me with every problem so far. Please accept my gratitude in your
effort to help me learn.

--
oakman
------------------------------------------------------------------------
oakman's Profile: http://www.excelforum.com/member.php...fo&userid=9172
View this thread: http://www.excelforum.com/showthread...hreadid=525659


--

Dave Peterson
 
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
formula not working properly nathanv3223 Excel Worksheet Functions 2 March 5th 09 02:16 PM
3d reference not working properly Bren Lane Excel Worksheet Functions 1 March 28th 07 10:15 PM
But not working properly Rao Ratan Singh Excel Discussion (Misc queries) 2 September 14th 06 08:45 AM
(xlDown) not working properly! aapp81[_25_] Excel Programming 7 December 10th 03 08:28 AM
(xlDown) not working properly! aapp81[_26_] Excel Programming 0 December 8th 03 08:43 PM


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