PDA

View Full Version : VB questions


Pi Man
06-11-2002, 11:14 AM
If I want to specify a string of several repeating characters (yyyyyyy or MMMMMMMMMM), is there a neat-o function that will do this; something where I specify the character and the number of them like:

Function("M",10)

Cho Da
06-11-2002, 11:25 AM
string(5,"e") --> "eeeee"

urysohn
06-11-2002, 11:46 AM
REPT(text, number_times) is an Excel worksheet function that does the same thing. (The thread title mentioned "VB" but the message text didn't clarify the context.)

Pi Man
06-12-2002, 01:29 PM
That worked really well - thanks!

Now I want to create an array of names. Can I explicitly create the array in a single command?

Something like this:

myArray = ("pi","buffy","glenn","cho da")

NoName
06-12-2002, 03:01 PM
Yes.
Sub test()
x = Array("hello", "goodbye", "xyz", "abc")
MsgBox x(2)
End Sub


gives the expected result.

That worked really well - thanks!

Now I want to create an array of names. Can I explicitly create the array in a single command?

Something like this:

myArray = ("pi","buffy","glenn","cho da")

Pi Man
06-14-2002, 02:38 PM
that works! thank you.

how do i return the number of rows in a selection?

i thought it was "selection.rows" but that's not doing it...

Gates Is Antichrist
06-14-2002, 02:47 PM
selection.rows.count

Pi Man
06-14-2002, 03:46 PM
thanks again - this is working out well...

the spreadsheet I am working in has named ranges... how do i access that structure?

Cho Da
06-14-2002, 03:52 PM
RTFM


Range("myName")

Pi Man
06-14-2002, 03:59 PM
1. what is "RTFM"?
2. the code assumes no knowledge of range names; it wants to find them and use them. for example; spreadsheet one has two range names; "States" and "shoes". the desired array would be ("states","shoes"). spreadsheet two has three named ranges; "me" and "you" and "rates". the array would be ("me","you","rates")...

Cho Da
06-14-2002, 04:33 PM
Read The Fine Manual

Application.Names

Pi Man
06-14-2002, 04:57 PM
if i had the manual (OR the stinking help files were installed on the PC i'm using), i wouldn't be here... this is a one-off project i've been asked to help with and i'm NOT extraordinarily VB-talented. i sincerely thank you all for your generous help.

Cho Da
06-14-2002, 05:02 PM
:rant: Why does the default install for MS Office not include the VB help files? (or the Link table manager in Access, or the Analysis ToolPak...)

Get those lame IT people up and have them do a complete install. Watch them do it. Make sure that nothing is set to run from CD, or Install on first use.

What a PITA.

Sorry if I was harsh. Using VB without access to the Object Browser and Help is a pointless guessing game.

Pi Man
06-14-2002, 05:42 PM
Cho Da - you said a mouthful, and it's exactly how i feel. in the mean time, I'm under a deadline and IT isn't... i didn't take it personally; i would have said the same. thanks again for the help.