+ Reply to Thread
Results 1 to 7 of 7

Macro to Find a Value and Copy a certain Range

  1. #1
    Registered User
    Join Date
    02-02-2011
    Location
    Ft Lewis, WA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Macro to Find a Value and Copy a certain Range

    Trying to build a macro that will search in Sheet 11 range AA1 to AZ 1, for the first occurance of the value of Sheet 13 A1. Once that row is found, next search for in Column AA for WDR and where the matched column and row are found copy the data along that row and paste into sheet 14. I need the same thing done for WSP, CIG, and OBV. Attached is a Sample. Thank You.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Find a Value and Copy a certain Range

    Why do you complicate the issue while the value of A1(16) is found in row 1 of Sheet11 and the data are copied from the same sheet? No need to duplicate A1 in to row 1 again. Row 1 shee11 would be enough.

  3. #3
    Registered User
    Join Date
    02-02-2011
    Location
    Ft Lewis, WA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Macro to Find a Value and Copy a certain Range

    The value of A1(16) will always be different, so for example it could be 22, in that case I would need to find the column with 22 and then look for WDR and copy the data from there.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Find a Value and Copy a certain Range

    No, you probably did not get my point. What ever you put a value in A1 will be found on row 1 sheet11. Am I right? For e.g. 22 is found in row 1 column AH , so why do you need to refer it to a different sheet? May be I am missing something.
    The rows you wan to copy are not the same as well. For WDR, you have 15 rows transposed in to columns while,WSP has less rows. How many columns do you want to copy?

  5. #5
    Registered User
    Join Date
    02-02-2011
    Location
    Ft Lewis, WA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Macro to Find a Value and Copy a certain Range

    Hello sorry. Try to explain better what is happening. On sheet 11 is an external data source, that updates every couple of hours. That is what is displayed on Sheet 11. On sheet 13, the value of A1 is the time frame or refernce point I need the data from. So in the example if Sheet 13 was 22, then I do not need the data prior to the column with 22 in it. But I need the data starting from column 22 on the Row marked WDR to the end of the data set, which would be AH4:AZ4, which is displayed on Sheet 14 down the first column. The same thing gor WSP, CIG, and OBV.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Find a Value and Copy a certain Range

    Not ideal solution. Try it
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-02-2011
    Location
    Ft Lewis, WA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Macro to Find a Value and Copy a certain Range

    AB33,

    Thanks your solution worked for what I was trying to do.

+ 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