+ Reply to Thread
Results 1 to 3 of 3

Select range for a Ref in the user form.

Hybrid View

  1. #1
    Registered User
    Join Date
    07-10-2014
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    10

    Select range for a Ref in the user form.

    Hi,

    My question is - for a Ref range in the user form, I want to set it up to only be able select from column A B and C. ( it has select ABC column at the same time, if missing any column, error message will come out, or select out of this range, the error message should also come up. )

    I know how to set the range to all three columns, but I know don't how to ask for " must select from all three column?"

    Thank you in advance for any help. !!

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Select range for a Ref in the user form.

    if your range is called refRange

    then
    if refRange.columns.count <> 3 then
    msgbox "3 columns are needed in this function"
    end if
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    07-10-2014
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    10

    Re: Select range for a Ref in the user form.

    Hi, Thanks for you reply!

    I tried it in my VBA, and it turn out the error " object doesn't support this property or method"
    My code is

    If refDataRange.Columns.Count <> 3 Then
    MsgBox (" Please select range from all A,B and C columns")
    End If

    Quote Originally Posted by nathansav View Post
    if your range is called refRange

    then
    if refRange.columns.count <> 3 then
    msgbox "3 columns are needed in this function"
    end if

+ 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] Select 1st item in a List box in a User form?
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2013, 11:23 AM
  2. User Form and Select Case Help
    By yusunghee in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2011, 01:22 PM
  3. User Form to select other User Forms
    By nms2130 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2011, 12:57 PM
  4. Code to select range and open a user form is opening the wrong range
    By rrbest in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2010, 12:34 PM
  5. How to: User Form to assign a user defined range to a macro variab
    By TrevTrav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-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