Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Programatically Naming Worksheets (using concatenated values)

1. that's one problem with working with a non-guru person - i didn't
code for every possibility, i just did what you wanted. :) i guess
in the part where it says:

V = MyRow + 15
n = MyRow
Do Until n = V

you could say

Do Until n=V Or n=LastCell.row

but as it stands right now LastCell isn't set until after this, so
you'd have to move that up with setting the V & n.....
as it is written right now it will ALWAYS do 15 rows, regardless of
what's in them, or anything else. so you could also change the line
above to

Do Until n=V Or n=""

if it's blank & you want to stop when it's blank. then you can change
the msgbox to report the actual # of rows that were handled......
you'd have to use MyRow subtracted from the current (last) value of n
& make that another variable (for instance, HowManyRows). then the
msgbox could be changed to:

If MsgBox(HowManyRows & " worksheets have been added." _

2. i can't help you with this part, you're beyond my understanding &
capabilities. sorry!

3. the macro is already using the hidden worksheet cell value - here
in the initialization sub:

Set sTotal = ActiveWorkbook.Worksheets("Number").Range("b3")
'the first time you run the sub this value is 0
'after that this value is where the macro stopped last
'time
myVar = sTotal.Value

lblLastTime.Caption = myVar

and then @ the end of the cmdContinue_click sub:

'change the label caption = V & save on hidden sheet "Number"
myVar = V - 1
sTotal = myVar

your starting row is captured by the refedit box (in case it is NOT
the row after the last row).

hope this helps. i'm truly sorry i can't help you with #2, but i can
learn while you're learning!
susan


On Mar 13, 1:46 pm, klysell .(donotspam) wrote:
Hi Susan,

Your code works very well muchas gracias! Ok, here it goes.....

Some Issues:
1. Using your test code:
Excel doesn't report the correct amount of cells that have been coloured.
Regardless of how many cells are left before the end of the list and
subsequently filled in yellow after enacting the macro, there are still "15
names added" reported in the message box. For example, let's say that 1 extra
name has been added in column C, and user chooses this last row to take on a
yellow fill, the message will still read that "15 names have been added"
(when in fact only 1 name has been highlighted in yellow). Of course there is
still the issue of the "LastCell" being changed to reflect the next line
somehow, and this likely causes related problems....

2. Substituting my code for your test code:
Excel still doesn't like the line: ActiveSheet.Name = cell.Value & "(" &
cell.Offset(0,1).Value & ")"
When the macro is enacted, Excel doesn't stop at 15 names (likely due to the
"LastCell" issue above), and instead craps out pointing to the
"ActiveSheet.Name=....." line above. When I take out this concatenated
feature, the macro still runs until but stops when it runs into our "Copy
After" issue reported to be a bug in Excel. I suspect that once this
"LastCell" issue is resolved and Excel goes to the next cell, the
concatenated feature will not cause Excel to trip (and neither will the "Copy
After" issue).

I'll keep on trying.... thanks to you am much closer to resolving this
issue. How can I use the Excel "hidden worksheet value" to tell the macro on
which row to
start? Hope I'm not overstaying my welcome on this issue... 'bout those
chocolates....

--
Kent Lysell
Financial Consultant
Ottawa, Ontario
(613) 907-1211



"Susan" wrote:
no beer; how 'bout chocolate? :)
ha ha
let me know if it works, please?
thanks
susan


On Mar 13, 11:54 am, klysell .(donotspam) wrote:
Hi Susan and Pete,


If you guys are ever in Ottawa, Ontario, I'll gladly buy you beer :) I'm in
the process of implementing Susan's code, and I can't thank you enough for
your help. Pete, I've known for some time that there would be problems with
respect to data validation when the user inputs an employee name or agreement
no. An illegal character - i.e. "/", ":" - would generate an error when used
in a worksheet name. Is there a catch-all fix that I could implement? Perhaps
I'll wait until I get this stage of the puzzle solved and then I'll tackle
the data validation issue. Thanks Susan and Pete!
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: (613) 943-9098
E-mail:


"Susan" wrote:
pete - oh. well, that's kent's problem. :) i'm not handling the
concatenated names, just the looping & userform. ha ha- Hide quoted text -


- Show quoted text -



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
index, match lookup using catenated values not working klysell Excel Worksheet Functions 2 May 3rd 07 07:05 PM
programatically creating worksheets Janet Panighetti Excel Programming 9 February 21st 07 02:43 AM
Programatically making worksheets dorre Excel Programming 1 February 5th 06 03:02 PM
Insert code into worksheets programatically?? Caro-Kann Defence[_2_] Excel Programming 3 April 6th 05 02:25 PM
programatically accessing Macros in worksheets Patrick[_8_] Excel Programming 1 April 15th 04 08:41 PM


All times are GMT +1. The time now is 03:35 PM.

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"