+ Reply to Thread
Results 1 to 3 of 3

VBA to allow selection of a Column Range

  1. #1
    Registered User
    Join Date
    11-21-2020
    Location
    Tamworth Australia
    MS-Off Ver
    2010
    Posts
    8

    VBA to allow selection of a Column Range

    Firstly as a complete VB novice I have so far floundered to this point with admirable aid from many others for which I am extremely grateful.
    Code does what I want with the Col E as currently default.

    I have one line of code Columns("E:E").Select and seek help to code so user can be given choice of columns. Range is E to BA.

    I have attached code which I acknowledge is rather clumsy as is a result of cut and paste plus trial and error. Content to remain as is but will certainly appreciate any suggestion
    At age 83 maybe should have stuck to COBOL.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 12-18-2020 at 09:40 AM. Reason: No need to make the entire post bold

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,852

    Re: VBA to allow selection of a Column Range

    I suggest you attach your actual Excel file instead of a Word file with code pasted in. That allows us to test any changes we might propose.

    If you want to show only your code, you can just paste it directly into your post (with CODE tags) rather than attaching a file with the code.

    Can you please explain what you want this entire Sub to do? I am having a hard time reverse engineering it.

    I will say that if you want to apply your changes to E to BA rather than just column E the fix is a simple one but the code needs other work as well. You do not need to Select a Range to operate on it, and it is almost always preferable not to do so. It appears that you started out by using the Macro Recorder which does not generate efficient code.

    You are unprotecting all sheets, then re-protecting all sheets, but you never do anything else on all sheets. Your operation on column E will apply only to the currently active sheet. Do you mean for this to be one big loop?

    You are declaring your variables but I also recommend you use Option Explicit.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-21-2020
    Location
    Tamworth Australia
    MS-Off Ver
    2010
    Posts
    8

    Re: VBA to allow selection of a Column Range

    Thanks Jazzer. You have pointed out many issue for me to investigate. Thanks. Will now marked as Solved and return to drawing board. May post again as I progress. Thanks for your efforts. G

+ 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. How to increase Range to More than One Column and remove error on multi selection?
    By mikedevt in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-09-2018, 04:52 PM
  2. [SOLVED] Defining Dynamic Selection Range in a Column
    By fpperryaz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2016, 03:42 PM
  3. Column range selection
    By jeanleysg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2015, 09:47 AM
  4. Create a code for offsetting range selection by 1 column
    By amartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2013, 12:56 PM
  5. Replies: 3
    Last Post: 07-24-2012, 10:35 AM
  6. cell selection in a given column range ?
    By cantabile in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2007, 10:09 PM
  7. [SOLVED] Moving Range Selection Right One Column at a Time
    By TexDad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2005, 03:30 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