+ Reply to Thread
Results 1 to 7 of 7

Getting a string array?

  1. #1
    Registered User
    Join Date
    08-04-2008
    Location
    South Africa
    Posts
    4

    Getting a string array?

    Hi,

    I am writing a addin toolbar in excel VBA.

    When I get a cell and the text inside, I want to compare the the text to replace it with something else.

    Eg. 27d8'35.7807" must be replaced with 27d08'35.7807"

    So I want to check for: after 'd' and before ' for a single digit and replace it with a 0 and the digit.

    Thats why I thought of using a string array. By putting the text of the cell in the string in the array and testing for a d and a '

    But the cell text must be in a object and if I use

    Please Login or Register  to view this content.
    c(1).Text is also the whole cell
    and I suspected it to be (like in the eg.) only 7

    Can anyone tell me how can I loop through the cell contents one digit at a time.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Does the position d change?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    Hi Johannekie ... if you really want to use an array, then take a look at the Characters property; this allows you to specify / examine an individual character within a string and change it if necessary. However, I'd suggest that you could do this using the InStr function instead. Hope that helps. MM.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  4. #4
    Registered User
    Join Date
    08-04-2008
    Location
    South Africa
    Posts
    4
    No, the position d will always be 3rd.

    Thank for all your help

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-04-2008
    Location
    South Africa
    Posts
    4
    Thanks, it works perfectly.

    Now I at least have something to work with.
    Thanks again

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Please mark this thread solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 9
    Last Post: 06-06-2009, 12:09 PM
  2. String array values to array of User-Defined Types
    By rtiltins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2008, 07:45 AM
  3. find string pos from strings in an array
    By friscokid in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-30-2008, 12:54 PM
  4. inputbox for simple verification purposes?
    By durandal05 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-08-2008, 06:03 PM
  5. Getting Data From User And Storing Into Array
    By Dan_Dollar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2007, 06:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1