+ Reply to Thread
Results 1 to 4 of 4

VBA - search specific value in cell and copy 10 lines (downward and sideward)

  1. #1
    Registered User
    Join Date
    04-09-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    7

    VBA - search specific value in cell and copy 10 lines (downward and sideward)

    Hi,

    I've recorded a macro where the pivot table will automatically constructed. However, the raw data is not always the same (total lines are different) therefore the grand total sum will not always be on the same line (refer below hard code range HC5 and B386). If this is a variable, how do I make the macro to search for the "grand total" word, sort from largest to smallest numbers and copy the next 10 cells (downward and sideward, separately of course.)

    The reason I want to copy due to the template that I want to paste the data into the template.

    Please Login or Register  to view this content.
    I have attached the image foryour ease of reference.

    sample1.jpg
    Many thanks.
    Last edited by juicersz; 04-10-2013 at 11:35 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: VBA - search specific value in cell and copy 10 lines (downward and sideward)

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

  3. #3
    Registered User
    Join Date
    04-09-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA - search specific value in cell and copy 10 lines (downward and sideward)

    davesexcel,

    thanks for the advice.

  4. #4
    Registered User
    Join Date
    04-09-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA - search specific value in cell and copy 10 lines (downward and sideward)

    I have solved this probelm by using the following code:

    Please Login or Register  to view this content.
    cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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