+ Reply to Thread
Results 1 to 6 of 6

Is it possible? VBA Macro for selecting rows by value returned from a column

Hybrid View

  1. #1
    Registered User
    Join Date
    03-02-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Is it possible? VBA Macro for selecting rows by value returned from a column

    I have a project to pull data from a large group of workbooks. The data is formatted backwards with the data titles listed in column A and the data listed out horizontally in rows. I want to flip it so I recorded a macro selecting the rows I want to keep and then pasting in a new page with a paste special transpose. Worked like a charm until I tried the same macro on the next worksheet and all the relevant data was in different rows so the data returned was not what I wanted. Code is at the bottom of post.

    I need code that will select rows that contain values within a column. That way I can run the macro on each new worksheet and it will only grab the data rows I want.

    For example; every row within column A that contains the word Director, Aspect Ratio, or Cast should be selected.

    Please excuse me if this is easy, I am still very new to macros and have little training.

    Sub Henson()
    '
    ' Henson Macro
    '
    ' Keyboard Shortcut: Option+Cmd+j
    '
    Sheets.Add
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = "clean data"
    Sheets("TV Template").Select
    Range("3:3,5:5,13:13,15:15,41:41,43:43,45:45,51:51,71:71,74:74,75:75").Select
    Selection.Copy
    Sheets("clean data").Select
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
    , Transpose:=True
    End Sub

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Is it possible? VBA Macro for selecting rows by value returned from a column

    Hello bubbaphat ! Welcome to the forum can you please upload a sample book to work with !
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Is it possible? VBA Macro for selecting rows by value returned from a column

    Welcome bubbaphat ,

    This code will only work the first time because you are working with Sheet1 instead of ActiveSheet.

    It would be really helpful if you attached an example of the workbooks so that we can see whet you're up to.

    Regards,

    David

    Please remember, your request is clearer if you attach a sample workbook.
    - Click on Go Advanced and click on the Paper Clip.
    When you reply please make it clear WHO you are responding to by mentioning their name.
    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.
    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  4. #4
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Is it possible? VBA Macro for selecting rows by value returned from a column

    Hello Find Attached ! It doesn't change the name of sheet1 to clean sheet!

    Run the macro and see if this is what you want !
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-02-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Is it possible? VBA Macro for selecting rows by value returned from a column

    Thank you so much for your help. I have modified the script an got it to work on a test sheet. Thanks again.

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Is it possible? VBA Macro for selecting rows by value returned from a column

    That's Cool !

+ 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] macro to delete rows based on returned row reference
    By bwaite87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2013, 06:34 PM
  2. Changing the number of rows when variable rows are returned by macro
    By intj.inc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-07-2012, 09:01 AM
  3. Replies: 4
    Last Post: 04-25-2010, 06:49 AM
  4. after selecting 50 rows of a column i can't reference the cells in the rows
    By Bob Salzer in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-21-2006, 05:35 PM
  5. Replies: 7
    Last Post: 06-19-2006, 01:20 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