+ Reply to Thread
Results 1 to 5 of 5

Coding Drop down

  1. #1
    Registered User
    Join Date
    11-14-2016
    Location
    banglore
    MS-Off Ver
    2016
    Posts
    9

    Coding Drop down

    I am very now to VBA coding and tried to find reason for below scinario, Could someone help me.


    1 -* *KK = Range("A" & Rows.Count).End(xlUp).Row

    2 -* *Lrow = Cells(Rows.Count, 1).End(xlUp).Row




    I have used above code for finding last filled last row in Columns A.

    in first case while writing code i got drop down selection after Range("A" & Rows.Count) and in second case drop down not available. I have given one example, Can someone say why its not available while starting with "cells".
    Is there any std procedure for this availability ?

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Coding Drop down

    Hi there,

    Both versions worked for me, so I'm not really sure what your problem is

    When writing code it is always better to use fully-qualified references as shown below:


    Please Login or Register  to view this content.

    Prefixing Range/Rows/Cells with a dot in the code above means that the worksheet from which these objects are derived is always the worksheet referenced by "wks", and not whichever worksheet happens to be active when the line of code is executed.


    Hope this helps,

    Regards,

    Greg M

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Coding Drop down

    This works and is assumed by VBA to be in the active sheet (or if code in a sheet module, then in that sheet)
    Please Login or Register  to view this content.
    Range is an OBJECT whereas CELLS is the PROPERTY of an object and so requires different handling

    Instead of
    Please Login or Register  to view this content.
    try
    Please Login or Register  to view this content.
    This article on excelmacromastery.com explains some of the differences between Cells(...) and Range(...)

    As explained by Greg in post#2 it is always safer to qualify with a worksheet reference
    Last edited by kev_; 05-24-2018 at 05:21 PM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    11-14-2016
    Location
    banglore
    MS-Off Ver
    2016
    Posts
    9

    Re: Coding Drop down

    Thank you every one

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

    Re: Coding Drop down

    It sound to me like you're talking about VBA intellisense.
    Although I'm not totally sure why some objects/methods etc give intellisense & some don't.

+ 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. Replies: 1
    Last Post: 10-12-2017, 12:00 PM
  2. Using color coding in a drop down menu.
    By Glossgurl7 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-23-2015, 05:36 PM
  3. [SOLVED] Drop down box coding to another cell
    By mdurkin in forum Excel General
    Replies: 2
    Last Post: 12-24-2012, 03:39 PM
  4. [SOLVED] Color Coding in a Drop Down List
    By Don in forum Excel General
    Replies: 6
    Last Post: 10-06-2012, 04:00 AM
  5. [SOLVED] Autoscroll through drop-down without hard coding the name of each value
    By yunesm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2012, 01:25 PM
  6. Replies: 0
    Last Post: 10-28-2011, 10:22 AM
  7. Drop-Down Coding help....
    By WGN in forum Excel General
    Replies: 0
    Last Post: 10-03-2011, 11:40 AM

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