+ Reply to Thread
Results 1 to 3 of 3

Declaring funktions value to variable

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    Gothenburg, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    6

    Declaring funktions value to variable

    Hi,

    I made a vba program which works fine. This program splits information from one cell into few cells. I think there is a better way to write the program. My program use formula, paste it into cell, calculate, then takes cell value (string) and paste it again into the cell. OK, this is fine, and it works while I dont have a lot of rows, but: I have 200.000 rows.

    So my question is: is there a better way to declare variable?

    All information is in column A and it looks like this:

    20103335 18.08.2010 18.08.2010 268 30635866 42.00 PCE 8.06 338.52 25
    I need a bold part in separate columns (Date 2, Buyer, Material, Volume, Value)

    Question 2: Is there a better way to change column? I used "switch" command.
    Question 3: I used if statement to jump over 7 and 8th loop sequence because I didnt need those informations, but I needed ninth. Is there a better way to do same thing?

    This is the code:

    Please Login or Register  to view this content.



    Thanks in advance.
    Last edited by arbeg; 12-21-2010 at 08:20 AM.

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

    Re: Declaring funktions value to variable

    Not sure what you mean, maybe Text To Columns
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-29-2010
    Location
    Gothenburg, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Declaring funktions value to variable

    Well, I just want to see if there is some other way (easier, faster) to do same job. Specialy loop part. As you can see, I put the formula into cell then I take cell value and put that value into same cell. Do I have to do it like this or is there any other way? Can I declare some variable:

    myVariable = Mid (............)

    Cells (Row, Column) = my Variable

    If yes, how?

    Secondly, i used switch command to move to another column as loop variable change. If i = 3 then paste everything into column C, if 4 then in D...

    In other words, is there some other way to extract parts of string into separate columns?

    20103335 18.08.2010 18.08.2010 268 30635866 42.00 PCE 8.06 338.52 25

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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