+ Reply to Thread
Results 1 to 2 of 2

getting macro dynamic

Hybrid View

  1. #1
    Registered User
    Join Date
    04-10-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    76

    getting macro dynamic

    Hi guys,

    I'm struggling with a code which a found on the forum. The code is perfect, only it isn't dynamic. I've tried almost everything that I know but I don't get it dynamic.

    The goal is to fill every cell from M3 until the end of row in column A. So if A ends at A43 than the code should work until M43.

        With Range("M3:M").Validation
         .Delete
         .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
          xlBetween, Formula1:="Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"
          .IgnoreBlank = True
         .InCellDropdown = True
         .InputTitle = ""
         .ErrorTitle = ""
         .InputMessage = ""
         .ErrorMessage = ""
         .ShowInput = True
         .ShowError = True
    End With
    I hope that you can help me guys.

    Kind regards,

    Soufian

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: getting macro dynamic

    Try this:
    last = Range("A3").End(xlDown).row
    With Range("M3:M" & last).Validation
         .Delete
         .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
          xlBetween, Formula1:="Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"
          .IgnoreBlank = True
         .InCellDropdown = True
         .InputTitle = ""
         .ErrorTitle = ""
         .InputMessage = ""
         .ErrorMessage = ""
         .ShowInput = True
         .ShowError = True
    End With
    Last edited by millz; 09-04-2013 at 07:58 AM.

+ 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. Dynamic macro
    By a94andwi in forum Excel General
    Replies: 11
    Last Post: 07-18-2014, 07:07 AM
  2. More dynamic macro...
    By belkira in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2009, 03:26 AM
  3. Dynamic Macro
    By Rgaherty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2008, 07:21 PM
  4. Dynamic Macro's
    By Myrlin1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-07-2007, 10:00 PM
  5. Dynamic Sort Macro
    By a94andwi in forum Excel General
    Replies: 13
    Last Post: 12-18-2006, 09:02 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