+ Reply to Thread
Results 1 to 7 of 7

Find right column then copy

  1. #1
    Registered User
    Join Date
    02-22-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72

    Find right column then copy

    Created a SAP script to take out report.

    Before it goes to work in SAP it does copy of column 1 in specific sheet.
    HTML Code: 
    This works fine but if layout changes then the data it is supposed to copy might not be in column 1. Therefore I would like it to search for the name of the column (Purch.Doc.) and then copy it.
    I tried below line and It’s not working (I’m new at this…). How can I make it work with simplest code possible?

    HTML Code: 





    HTML Code: 

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Find right column then copy

    Is it as simple as the full stop (point) at the end of (Purch.Doc.)
    This works fine but if layout changes then the data it is supposed to copy might not be in column 1. Therefore I would like it to search for the name of the column (Purch.Doc.) and then copy it.

  3. #3
    Registered User
    Join Date
    02-22-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Find right column then copy

    Quote Originally Posted by torachan View Post
    Is it as simple as the full stop (point) at the end of (Purch.Doc.)
    Sorry, I'm new at this. Don't know what full stop (point) means.
    Last edited by Cuni; 01-21-2021 at 11:36 AM.

  4. #4
    Registered User
    Join Date
    02-22-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Find right column then copy

    Solved. Not even sure what "Long" means but it seems to work...


    Instead of
    HTML Code: 
    I used

    HTML Code: 

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Find right column then copy

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Spot the difference in the two codes.
    I was trying to subtly point out in post #2.
    There was a 'dot' (English - 'fullstop' or American - 'point') missing from the end of "Purch.Doc"
    Such a small thing can cause hours of headaches.
    torachan.

  6. #6
    Registered User
    Join Date
    02-22-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Find right column then copy

    I get Type mismatch when using below line

    HTML Code: 
    Last edited by Cuni; 01-22-2021 at 03:33 AM.

  7. #7
    Registered User
    Join Date
    02-22-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Find right column then copy

    Final result


    HTML Code: 

+ 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. [SOLVED] Excel VBA Macro - Find Word and Select that Column to Column D and copy
    By MsBBStacker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2015, 12:04 AM
  2. Replies: 4
    Last Post: 01-07-2015, 08:29 PM
  3. Replies: 5
    Last Post: 08-01-2014, 04:30 PM
  4. [SOLVED] Find Substring with in special charecters from a column and copy it to another column -vba
    By Sailaja A in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-18-2013, 09:51 AM
  5. [SOLVED] Macro to find the empty cell in a column and copy a adjacent row to another column.
    By naga in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-18-2013, 07:44 AM
  6. Vba - find next empty column, insert column, copy paste values & copy paste formulas
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 12:43 PM
  7. Replies: 1
    Last Post: 05-06-2011, 03:08 AM

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