+ Reply to Thread
Results 1 to 15 of 15

Problem with macro code

  1. #1
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Problem with macro code

    Dear all


    i have the following code

    Please Login or Register  to view this content.
    which basically puts the value of Column "AN" into Column "C" of another sheet.

    I would like to also put values of Column "L" of the same sheet in "C" with the pipe | symbol separating those two values.

    Can you help ?

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    So something like below?
    Please Login or Register  to view this content.
    Or is column L in same sheet with "C" column?

    If so... try.
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    first is the case ... let me try it

  4. #4
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    Yes. Awesome. Thank you!

    At a later stage, I need to break these "|" separated values in one cell up into two cells again. How could this be done ?

    E.g. 47377373|48834884 in Column A into Column B and C

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    If in VBA just use Split function.

    Please Login or Register  to view this content.
    Or if you need it as number and not string type.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    That's great - thank you so much ! Solved ! Cheers

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    You are welcome and thanks for the rep

  8. #8
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    sorry to bother again,

    Please Login or Register  to view this content.
    does only A1

    how do I split entire column ?

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    I am away from pc for rest of the day.
    I’ll give more details tomorrow, but basically you need to loop each cell of column.
    Or do it in memory using array.

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    So, lets say you have value in Column A, starting from row 2, but end is not fixed.

    You'd loop like below.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    i just tried that with

    1498945308004|142246606918
    1498985904004|140912299431
    921787780023|362008752737
    1499009563004|142415121092
    921792748023|361880684487
    921810213023|361907883745
    1499047192004|140912298233
    921821069023|361994377667
    921891390023|361880804032
    921897893023|361880786571
    1499203234004|142505575523


    it gave me a runtime error "overflow" in
    Please Login or Register  to view this content.

  12. #12
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    It would since 1498945308004 is greater than Long type's limit.

    If you need it as numeric use CDbl. But from the looks of it, it's some sort of ID, then just use it as string without CLng or CDbl.

  13. #13
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    yes, those are item id's and transaction id's
    Last edited by elgato74; 02-09-2018 at 09:42 AM.

  14. #14
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    568

    Re: Problem with macro code

    perfect. now it works like a charm.
    Thank you again

  15. #15
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,889

    Re: Problem with macro code

    You are welcome If this solved your issue, please mark the thread as solved by using Thread tool found at top right of your initial post.

+ 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. need help with macro code problem
    By Dimy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2015, 04:39 AM
  2. Problem with name in the macro code
    By jpol in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-23-2013, 07:45 AM
  3. Problem with Macro printing code
    By Usethaschwarz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-25-2012, 08:56 AM
  4. VBA/Macro Code Problem
    By marc5354 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-04-2010, 02:45 PM
  5. Problem with simple macro/VBA code
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-24-2008, 07:44 AM
  6. Problem with Macro Code
    By John in forum Excel General
    Replies: 3
    Last Post: 04-06-2006, 09:50 AM
  7. [SOLVED] Macro Code Problem
    By unique in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2005, 12:05 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