+ Reply to Thread
Results 1 to 8 of 8

VBA - Selecting all cells in specific columns from selected rows

  1. #1
    Registered User
    Join Date
    04-11-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    5

    VBA - Selecting all cells in specific columns from selected rows

    I want to use VBA to aid personnel in removing formulas (ie copy and paste value) from specific columns in a worksheet once the data in each row or rows is finalised. The columns will be the same columns every time, but the rows will obviously change on each occasion as we finalise the data in each row or rows. Currently, user error means some columns are selected and values fixed in error before they are ready.

    A B C D E
    1 4 3 6 8 2
    2 6 7 5 4 9
    3 8 2 1 5 3
    4 3 7 8 2 5
    5 9 5 6 8 9

    For example, in the above I would like to select rows 4 and 5 manually, then run some VBA to select all the cells in columns B and D for the selected row range (rows 4 and 5). Then I want to copy those cells and paste the values in situ.

    I am fairly inexperienced with VBA code. I can achieve copying and pasting the values in situ using VBA, but I am struggling with the selection of multiple column ranges from just the rows selected. I would be most grateful for any help anyone can provide.

    Thanks

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: VBA - Selecting all cells in specific columns from selected rows

    If it's just the two columns try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-11-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    5

    Re: VBA - Selecting all cells in specific columns from selected rows

    Thanks Fluff13. My actual example involves around 60 columns to be selected and fixed out of a total 100 columns. Would this lead to suggesting to approach it another way, or should I simply replicate what youve suggested for all the columns I need fixed?
    Thanks very much.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: VBA - Selecting all cells in specific columns from selected rows

    another option:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: VBA - Selecting all cells in specific columns from selected rows

    @Arkadi
    That will copy the values in col B to col D as well.

    How about
    Please Login or Register  to view this content.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: VBA - Selecting all cells in specific columns from selected rows

    @Fluff13, good call... silly me, I didn't think that through.

  7. #7
    Registered User
    Join Date
    04-11-2018
    Location
    London
    MS-Off Ver
    2016
    Posts
    5

    Re: VBA - Selecting all cells in specific columns from selected rows

    Thanks All, this is working perfectly now, and dovetails nicely with the code to change the colour of the cells as the values are fixed.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: VBA - Selecting all cells in specific columns from selected rows

    You're welcome

+ 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. Selecting Specific Cells with Multiple Sheets Selected
    By quantifyrisk in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-14-2016, 10:28 AM
  2. [SOLVED] Selecting all data in specific columns without selecting adjacent column.
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2014, 02:20 AM
  3. Selecting all data in specific columns without selecting adjacent column.
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2014, 03:50 PM
  4. Excel VBA/Macro: Selecting Specific Columns and Rows in Pivot Table and Formatting
    By rarascon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2013, 03:50 PM
  5. Selecting non-adjacent cells from different rows/columns
    By excelactuary in forum Excel General
    Replies: 4
    Last Post: 03-08-2013, 11:10 AM
  6. Selecting rows of selected cells
    By jdskin2 in forum Excel General
    Replies: 2
    Last Post: 02-09-2012, 04:34 PM
  7. [SOLVED] delete columns and rows-cells equalling zero or any selected value
    By Scottie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2005, 04:06 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