+ Reply to Thread
Results 1 to 5 of 5

is there any way to simplify this command ActiveSheet.Shapes("Drop Down 1154")

  1. #1
    Registered User
    Join Date
    01-26-2019
    Location
    Colombia
    MS-Off Ver
    2017
    Posts
    16

    is there any way to simplify this command ActiveSheet.Shapes("Drop Down 1154")

    ActiveSheet.Shapes("Drop Down 1154").ControlFormat.Value = 1
    ActiveSheet.Shapes("Drop Down 2053").ControlFormat.Value = 1
    ActiveSheet.Shapes("Drop Down 2054").ControlFormat.Value = 1
    ActiveSheet.Shapes("Drop Down 2055").ControlFormat.Value = 1

    i just want to have a global configuration that does this command instead of every single one, there's like 30 so it slows down quite alot the opening of the excel sheet



    thanks in advance to everybody!

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,157

    Re: is there any way to simplify this command ActiveSheet.Shapes("Drop Down 1154")

    For example:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: is there any way to simplify this command ActiveSheet.Shapes("Drop Down 1154")

    If the command can be simplified depends on how much logic the names have or if the only shapes on the sheet are the 30 dropdowns.
    if the dropdowns are the only ones on the sheet (untested)

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-26-2019
    Location
    Colombia
    MS-Off Ver
    2017
    Posts
    16

    Re: is there any way to simplify this command ActiveSheet.Shapes("Drop Down 1154")

    imma try both solutions one sec

  5. #5
    Registered User
    Join Date
    01-26-2019
    Location
    Colombia
    MS-Off Ver
    2017
    Posts
    16

    Re: is there any way to simplify this command ActiveSheet.Shapes("Drop Down 1154")

    Option Explicit

    Sub drop_down_number()
    Dim drpdwn, i As Long, indx As Long

    drpdwn = Array(1154, 2053, 2054, 2055)
    indx = UBound(drpdwn)

    With ActiveSheet
    '... commands
    For i = 0 To indx
    .Shapes("Drop Down " & drpdwn(i)).ControlFormat.Value = 1
    Next
    '... further commands
    End With
    End Sub



    this worked out perfectly thank you!!!

+ 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] ActiveSheet.Name = ActiveSheet.Range("G1"), Worksheet_Calculate Event not working, 1004
    By xlyfe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-28-2018, 11:24 AM
  2. Replies: 3
    Last Post: 05-02-2018, 08:03 AM
  3. ActiveSheet.Unprotect("pass") / ActiveSheet.Protect ("pass") breaks functionality
    By Proventus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-02-2016, 10:30 PM
  4. [SOLVED] How can I add "If ActiveSheet.Name = "Sheet2" Then" to the following code in a module ?
    By omega0010 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2014, 11:57 PM
  5. [SOLVED] If Not ActiveSheet.Range("A1").Value Like "apple" Then MsgBox "Error"
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-18-2014, 02:16 PM
  6. Create a Command Button to "Save As" and "Close" an Excel Workbook
    By thedunna in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-26-2013, 05:38 PM
  7. Replies: 3
    Last Post: 03-08-2013, 09:28 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