Results 1 to 1 of 1

VBA code not working for Autofill combo box, If I use INDIRECT formula

Threaded View

rajeshn_in VBA code not working for... 10-09-2016, 02:23 AM
  1. #1
    Forum Contributor
    Join Date
    04-06-2016
    Location
    Singapore
    MS-Off Ver
    MS Office 365 & 2010
    Posts
    701

    VBA code not working for Autofill combo box, If I use INDIRECT formula

    Some Drop down lists Autofill combo box not working, At sample "daily entry", B column combo box working with auto fill, D, E columns not working autofill, Please edit my VBA code.
    My VBA code :
    (Sample file attached)

    Option Explicit
    ' Developed by Contextures Inc.
    ' www.contextures.com
    Private Sub TempCombo_KeyDown(ByVal _
            KeyCode As MSForms.ReturnInteger, _
            ByVal Shift As Integer)
    'move to next cell on Enter and Tab
    Dim varVal As Variant
    On Error Resume Next
     'change text value to number, if possible
    varVal = --ActiveCell.Value
    If IsEmpty(varVal) Then
      varVal = ActiveCell.Value
    End If
    
    Select Case KeyCode
      Case 9  'tab
        ActiveCell.Value = varVal
        ActiveCell.Offset(0, 1).Activate
      Case 13 'enter
        ActiveCell.Value = varVal
        ActiveCell.Offset(1, 0).Activate
      Case Else
        'do nothing
    End Select
    
    End Sub
    
    Private Sub TempCombo_LostFocus()
      With Me.TempCombo
        .Top = 10
        .Left = 10
        .Width = 0
        .ListFillRange = ""
        .LinkedCell = ""
        .Visible = False
        .Value = ""
      End With
    End Sub
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim str As String
    Dim cboTemp As OLEObject
    Dim ws As Worksheet
    Dim wsList As Worksheet
    
    Set ws = ActiveSheet
    Set wsList = Sheets("ALL ACCOUNTS")
    Set cboTemp = ws.OLEObjects("TempCombo")
      On Error Resume Next
      With cboTemp
        .ListFillRange = ""
        .LinkedCell = ""
        .Visible = False
      End With
    On Error GoTo errHandler
      If Target.Validation.Type = 3 Then
       Cancel = True
        Application.EnableEvents = False
        str = Target.Validation.Formula1
        str = Right(str, Len(str) - 1)
        With cboTemp
          .Visible = True
          .Left = Target.Left
          .Top = Target.Top
          .Width = Target.Width + 15
          .Height = Target.Height + 5
          .ListFillRange = str
          .LinkedCell = Target.Address
        End With
        cboTemp.Activate
      End If
      
    errHandler:
      Application.EnableEvents = True
      Exit Sub
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ActiveX Combo Box and VBA code not working on multiple Data Validation Dropdown Lists
    By ringonohitorigoto in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-29-2016, 04:05 PM
  2. autofill vba code not working
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2015, 07:58 PM
  3. Formula is not working - need indirect function?
    By lexusap in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-23-2015, 06:36 PM
  4. autofill indirect formula with moving average
    By jeff33 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-03-2015, 07:36 PM
  5. [SOLVED] Combo Box Code Stopped Working
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-07-2014, 01:20 PM
  6. Indirect not working with array formula?
    By HKX in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-23-2012, 07:53 AM
  7. [SOLVED] VBA Code (colums to row, autofill) stop working in row 294 when new cable code appear
    By sknifseht in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 05:27 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