How to use a Variable in different a Userform/module

bcmk29

Board Regular
Joined
Oct 20, 2022
Messages
55
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I've got 2 different UserForms (UserForm & DataMap) with multiple modules in them.

1. Here's the code of my first Form UserForm. Where I'm allowing the user to select a spreadsheet and assign the file name to Importworkbook.

VBA Code:
Private Sub UserForm_Initialize()
'DataMap.Show vbModeless

    Dim LR, IB As Long
    Dim FileLocation As String
   
    Sheets("Input").Select
    Range("A1").Select
    Sheets("Sheet3").Range("R1").Value = 0
    file = ActiveWorkbook.Name
    LR = Cells(Rows.Count, 1).End(xlUp).Row
   
    If LR = 1 Then Else GoTo ok
   
        [B]FileLocation = Application.GetOpenFilename("(*.xlsx),")
       
        If FileLocation = "False" Then
            MsgBox "No file selected to import.", 48
            Unload Me
        Exit Sub
        End If
    End If
   
    Set Importworkbook = Workbooks.Open(Filename:=FileLocation)[/B]
   
    If Importworkbook.Sheets.Count > 1 Then
reIB:
        IB = Application.InputBox("Enter worksheet number", "Worksheet selection", , , , , , 1)
            If IB > Sheets.Count Then
                MsgBox "Invalid Sheet Input, Try Again.", 48, "Entry Required"
                GoTo reIB
            Else
                Sheets(IB).Select
            End If
            GoTo hi
    Else: End If
hi:
    ActiveSheet.Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Copy
    Workbooks(file).Activate
    Sheets("Sheet3").Select
    Range("P2").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Application.CutCopyMode = False
    Range("P1").Select
ok:
End Sub

2. Here's the code for my second Form DataMap, where I'm replicating the same set of codes from above. Instead, I just need to get the name of Importworkbook from my earlier code which is assigned in different userform/module. Please assist.

VBA Code:
Sub DataImport()
    Dim LR As Long
    Dim FileLocation As String
    Dim A, A1 As Integer
    LR = Cells(Rows.Count, 1).End(xlUp).Row
    If LR = 1 Then Else GoTo ok

[B]    FileLocation = Application.GetOpenFilename("(*.xlsx),")
    If FileLocation = "False" Then
        MsgBox "No file selected to import.", 48
        Exit Sub
    End If
    Set Importworkbook = Workbooks.Open(Filename:=FileLocation)[/B]

    ThisWorkbook.Worksheets(2).Activate
    SH = ThisWorkbook.Worksheets(4).Cells(Rows.Count, 19).End(xlUp).Row
For A = 2 To SH

'MsgBox DataMap!mastrImportworkbook
    Importworkbook.Worksheets(1).Range(Sheets("Sheet3").Range("T" & A).Value).Copy ThisWorkbook.Worksheets(2).Cells(1, A - 1)
Next A
    Application.ScreenUpdating = True
    ThisWorkbook.Worksheets(3).Range("A1:u1").Copy
    ThisWorkbook.Worksheets(2).Range("A1:u1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A1").Select
    Importworkbook.Close
    Application.ScreenUpdating = True

    ThisWorkbook.Worksheets(4).Select
    Range("P2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents
    Range("S2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents
    Range("R1").Select
    Selection.ClearContents
    ThisWorkbook.Worksheets(2).Select
    Range("A1").Select
ok:
   UserForm1.Show
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi bcmk29,

please understand that I find it extremely difficult to understand why you use this event (UserForm_Initialize) to perform code that is not used further on in the code you supplied - without seeing the data or getting more information it's more a try and error from my side.

Anyhow I build a sample in order to perform at least the first code which I modified to read

VBA Code:
Private Sub UserForm_Initialize()
'DataMap.Show vbModeless
  
  Dim lngIndexWS As Long
  Dim varFile As Variant
  Dim wbActive As Workbook
  Dim rng As Range
  
  Application.Goto Sheets("Input").Range("A1")
  Sheets("Sheet3").Range("R1").Value = 0
  Set wbActive = ActiveWorkbook
  
  If Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then GoTo end_here
    
  If wbkImport Is Nothing Then
    varFile = Application.GetOpenFilename("(*.xlsx),", MultiSelect:=False)
    If varFile = "False" Then
      MsgBox "No file selected to import.", 48
      GoTo end_here
    End If
    Set wbkImport = Workbooks.Open(Filename:=varFile)
  End If
  
  If wbkImport.Sheets.Count > 1 Then
reIB:
    lngIndexWS = Application.InputBox("Enter worksheet number", "Worksheet selection", , , , , , 1)
    If lngIndexWS > Sheets.Count Then
      MsgBox "Invalid Sheet Input, Try Again.", 48, "Entry Required"
      GoTo reIB
    Else
      Sheets(lngIndexWS).Select
    End If
  End If

  Set rng = ActiveSheet.Range("A1").Resize(1, Cells(1, Columns.Count).End(xlToLeft).Column)
  wbActive.Sheets("Sheet3").Range("P2").Resize(1, rng.Columns.Count).Value = rng.Value
  Set rng = Nothing
  Application.Goto wbActive.Sheets("Sheet3").Range("P1")
end_here:
  Set wbActive = Nothing
End Sub

In my sample the first code ran without errors but I would need further information for the second UF - what triggers the code, if this part of code

VBA Code:
...Range(Sheets("Sheet3").Range("T" & lngImport).Value)...

means using the Indirect Function via VBA, if you can use Copy Paste/Transform, why the area which I identify as Target in the sheet should be overwritten with the next codeline....

Ciao,
Holger
 
Upvote 0
Hi bcmk29,

please understand that I find it extremely difficult to understand why you use this event (UserForm_Initialize) to perform code that is not used further on in the code you supplied - without seeing the data or getting more information it's more a try and error from my side.

Anyhow I build a sample in order to perform at least the first code which I modified to read

VBA Code:
Private Sub UserForm_Initialize()
'DataMap.Show vbModeless
 
  Dim lngIndexWS As Long
  Dim varFile As Variant
  Dim wbActive As Workbook
  Dim rng As Range
 
  Application.Goto Sheets("Input").Range("A1")
  Sheets("Sheet3").Range("R1").Value = 0
  Set wbActive = ActiveWorkbook
 
  If Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then GoTo end_here
 
  If wbkImport Is Nothing Then
    varFile = Application.GetOpenFilename("(*.xlsx),", MultiSelect:=False)
    If varFile = "False" Then
      MsgBox "No file selected to import.", 48
      GoTo end_here
    End If
    Set wbkImport = Workbooks.Open(Filename:=varFile)
  End If
 
  If wbkImport.Sheets.Count > 1 Then
reIB:
    lngIndexWS = Application.InputBox("Enter worksheet number", "Worksheet selection", , , , , , 1)
    If lngIndexWS > Sheets.Count Then
      MsgBox "Invalid Sheet Input, Try Again.", 48, "Entry Required"
      GoTo reIB
    Else
      Sheets(lngIndexWS).Select
    End If
  End If

  Set rng = ActiveSheet.Range("A1").Resize(1, Cells(1, Columns.Count).End(xlToLeft).Column)
  wbActive.Sheets("Sheet3").Range("P2").Resize(1, rng.Columns.Count).Value = rng.Value
  Set rng = Nothing
  Application.Goto wbActive.Sheets("Sheet3").Range("P1")
end_here:
  Set wbActive = Nothing
End Sub

In my sample the first code ran without errors but I would need further information for the second UF - what triggers the code, if this part of code

VBA Code:
...Range(Sheets("Sheet3").Range("T" & lngImport).Value)...

means using the Indirect Function via VBA, if you can use Copy Paste/Transform, why the area which I identify as Target in the sheet should be overwritten with the next codeline....

Ciao,
Holger
Please see my complete code below (1,2,3,4) from Userfrom & (5) from DataImport, there are multiple modules in here. Let me brief you on the purpose.

1. With the below code I'm importing a spreadsheet of user choice and getting the header values to a worksheet of my choice.

VBA Code:
Private Sub UserForm_Initialize()
'DataMap.Show vbModeless
 
  Dim lngIndexWS As Long
  Dim varFile As Variant
  Dim wbActive As Workbook
 
  Sheets("Input").Range("A1").Select
  'Sheets("Sheet3").Range("R1").Value = 0
  Set wbActive = ActiveWorkbook
 
  If Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then GoTo end_here
  
  If wbkImport Is Nothing Then
    varFile = Application.GetOpenFilename("(*.xlsx),", MultiSelect:=False)
    If varFile = "False" Then
      MsgBox "No file selected to import.", 48
      GoTo end_here
    End If
    Set wbkImport = Workbooks.Open(Filename:=FileLocation)
  End If
 
  If wbkImport.Sheets.Count > 1 Then
reIB:
    lngIndexWS = Application.InputBox("Enter worksheet number", "Worksheet selection", , , , , , 1)
    If lngIndexWS > Sheets.Count Then
      MsgBox "Invalid Sheet Input, Try Again.", 48, "Entry Required"
      GoTo reIB
    Else
      Sheets(lngIndexWS).Select
    End If
  End If

  ActiveSheet.Range("A1").Resize(1, Cells(1, Columns.Count).End(xlToLeft).Column).Copy
  Application.Goto wbActive.Sheets("Sheet3").Range("P2")
  ActiveSheet.PasteSpecial Paste:=xlPasteValues, _
                            Operation:=xlNone, _
                            SkipBlanks:=False, _
                            Transpose:=True
  Application.CutCopyMode = False
  Range("P1").Select
 
end_here:
  Set wbActive = Nothing
End Sub

2. Once after receiving the header I'm passing those headers to the fixed combobox in the userform.

VBA Code:
Private Sub UserForm_Activate()
'DataMap.Show vbModeless
    IH = Cells(Rows.Count, 16).End(xlUp).Row
  
    ComboBox99.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox22.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox33.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox44.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox55.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox66.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox77.List = Sheets("Sheet3").Range("P2:P" & IH).Value
    ComboBox88.List = Sheets("Sheet3").Range("P2:P" & IH).Value
  
    Sheets("Input").Select
  
    Range("A1").Select
  
End Sub

3. With the CommandButton1 (Add Header) I'm allowing the user to create an additional Listbox & Combobox and assign value to them for the user to select. See the screenshot attached.

VBA Code:
Private Sub CommandButton1_Click()
    'DataMap.Show vbModeless
    Dim theLabel As Object
    Dim Height, IH, DH  As Long
    Static m, n As Long

    IH = Sheets("Sheet3").Cells(Rows.Count, 16).End(xlUp).Row
    DH = Sheets("Sheet3").Cells(Rows.Count, 21).End(xlUp).Row

    'Sheets("Sheet3").Range("R1").Value = Sheets("Sheet3").Range("R1").Value + 1
    'n = Sheets("Sheet3").Range("R1").Value
  
    n = n + 1
    Height = 202
    Set theListBox = Me.Controls.Add("Forms.listbox.1", True)
    m = m + 1
    With theListBox
        .Name = "Listbox" & m
        .Left = 17
        .Height = 20
        .Width = 92
        .Top = Height + (25 * n)
        .RowSource = "Sheet3!U10:U" & DH
    'For m = 2 To IH
        '.AddItem (Sheets("Sheet3").Range("U" & m).Value)
    'Next m
    End With
    Set theComboBox = Me.Controls.Add("Forms.combobox.1", True)
    Height = 200
    With theComboBox
        .Name = "Combobox" & m
        .Left = 114
        .Width = 107
        .Top = Height + (25 * n)
        .RowSource = "Sheet3!P2:P" & IH
    End With
    Height = 225
    With CommandButton1
        .Left = 30
        .Top = Height + (25 * n)
    End With
    Height = 225
    With CommandButton2
        .Left = 126
        .Top = Height + (25 * n)
    End With
    Height = 305
    DataMap.Height = Height + (25 * n)
    Height = 260
    With Label9
        .Caption = n & " Field Added"
        .Left = 86
        .Top = Height + (25 * n)
        If n > 1 Then
            .Caption = n & " Fields Added"
        End If
    End With
    Me.Tag = m
End Sub

4. With the CommandButton2 (Proceed) I'm checking if any of the Combobox is left empty before proceeding to the next module. See the screenshot of userform attached.

VBA Code:
Private Sub CommandButton2_Click()
'UserForm.Show vbModeless

    Dim arr()       As Variant
    Dim AddHeader   As Long, i As Long
    Dim IsComplete  As Boolean
  
    AddHeader = Val(Me.Tag)
  
    ReDim arr(1 To 8 + AddHeader)
  
    For i = 1 To UBound(arr)
        If i < 9 Then
            'mandatory controls
            With Me.Controls("ComboBox" & Choose(i, 99, 22, 33, 44, 55, 66, 77, 88))
                IsComplete = Len(.Value) > 0
                If IsComplete Then arr(i) = .Value Else .SetFocus: Exit For
            End With
        Else
             With Me.Controls("ComboBox" & i - 8)
                IsComplete = Len(.Value) > 0
                If IsComplete Then arr(i) = .Value Else .SetFocus: Exit For
            End With
        End If
    Next i
  
    If IsComplete Then
        ThisWorkbook.Worksheets("Sheet3").Range("S2").Resize(UBound(arr)).Value = Application.Transpose(arr)
        Unload Me
        Call DataImport
    Else
        MsgBox "Please fill all the blank field(s)", 48, "Entry Required"
    End If
End Sub
[/CODE]

5. Upon successful execution of all the above modules I'm calling DataImport to import the data to my workbook based on what user has selected in the userform and finally calling UserForm1 to do the rest of my job. Getting through the Userform & DataImport is the issue now. I'M UNABLE TO MAKE USE OF THE WORKSHEET SELECTED IN MODULE 1 (USERFORM) IN MODULE 1(DATAIMPORT). Right now I'm making the user select the file once again.

VBA Code:
Sub DataImport()
  Dim varFile As Variant
  Dim A As Integer
  Dim SH As Long
 
  LR = Cells(Rows.Count, 1).End(xlUp).Row
  If Cells(Rows.Count, 1).End(xlUp).Row = 1 Then Else GoTo ok

  If wbkImport Is Nothing Then
    varFile = Application.GetOpenFilename("(*.xlsx),", MultiSelect:=False)
    If varFile = "False" Then
        MsgBox "No file selected to import.", 48
        Exit Sub
    End If
    Set wbkImport = Workbooks.Open(Filename:=varFile)
  End If
  
For lngImport = 2 To ThisWorkbook.Worksheets(4).Cells(Rows.Count, 19).End(xlUp).Row

'MsgBox DataMap!mastrImportworkbook
    wbkImport.Worksheets(1).Range(Sheets("Sheet3").Range("T" & lngImport).Value).Copy ThisWorkbook.Worksheets(2).Cells(1, lngImport - 1)
  Next lngImport
 
    Application.ScreenUpdating = True
With ThisWorkbook
    .Worksheets(3).Range("A1:u1").Copy
    With .Worksheets(2).Range("A1").Resize(1, 21)
      .PasteSpecial Paste:=xlPasteValues, _
                    Operation:=xlNone, _
                    SkipBlanks:=False, _
                    Transpose:=False
      .PasteSpecial Paste:=xlPasteFormats, _
                    Operation:=xlNone, _
                    SkipBlanks:=False, _
                    Transpose:=False
    End With
  End With
  Application.CutCopyMode = False
  wbkImport.Close SaveChanges:=False
  Application.ScreenUpdating = True

  With ThisWorkbook.Worksheets(4)
    .Range("P2").Resize(.Cells(.Rows.Count, "P").End(xlUp).Row - 1, 1).ClearContents
    .Range("S2").Resize(.Cells(.Rows.Count, "S").End(xlUp).Row - 1, 1).ClearContents
    .Range("R1").ClearContents
  End With
  Application.Goto ThisWorkbook.Worksheets(2).Range("A1"), Scroll:=True
ok:
   UserForm1.Show
 
End Sub

Sorry if i'm not being clear in my context i'm a newbee in VBA and still learning. I doesn't know all the short codes to code.

1666543475948.png
 
Last edited:
Upvote 0
Hi bcmk29,

thanks for sharing all your code. Please allow me to take some time to work through the code supplied. As I will build a sample file for testing and think about the workplan and codes I expect to come back here only by tomorrow sometime around noon.

And since we all started with VBA without knowledge of that programming language and only some very gifted persons learn on the fly be assured that constantly working with codes will improve your skills and your knowledge.

Like Arnie said: I'll be back ;)
Holger
 
Upvote 0
Hi bcmk29,

I'm still unsure about what your data looks like so I had to do some guessing.

First of all you should avoid referencing sheets or worksheets by their indexnumber - if you do not protect the structure sheets may be moved resulting in either run-time errors or unwanted results. Referring to the tab sheetnames is more reliant in my eyes as the sheets could be moved anywhere but users may change these names (resulting in run-time errors). The safest way for me is to refer to the CodeName of the sheets: it can only be altered in the VBE or by code, and most people don't even know that CodeNames exist. And it worls without problems in ThisWorkbook, teh workbook with the code. By default CodeNames will not be accepted if you refer to a differetn workbook - there's a workaround to use them anyhow.

I worked with tab sheetnames in my codes.

I inserted 2 standard modules (I actually renamed them to modStartUF and modDataImport), code for modStartUF

VBA Code:
Public gwkbImport As Workbook
Public gwsNewHeader As Worksheet
'

Sub Call_UF()

  UserForm1.Show

End Sub

Code for modDataImport:

VBA Code:
Sub DataImport()
  Dim lngImport               As Long
  
  Const cblnClearGlobals      As Boolean = False
  
  '/// This loop can be omitted as the following code overwrites some/most/all of the data
  For lngImport = 2 To ThisWorkbook.Worksheets("Sheet4").Cells(Rows.Count, 19).End(xlUp).Row
    gwsNewHeader.Range(Sheets("Sheet3").Range("T" & lngImport).Value).Copy ThisWorkbook.Worksheets("Input").Cells(1, lngImport - 1)
  Next lngImport
 
  Application.ScreenUpdating = True
  With ThisWorkbook
    .Worksheets("Sheet3").Range("A1:U1").Copy
    With .Worksheets("Input").Range("A1").Resize(1, 21)
        .PasteSpecial Paste:=xlPasteValues, _
                      Operation:=xlNone, _
                      SkipBlanks:=False, _
                      Transpose:=False
        .PasteSpecial Paste:=xlPasteFormats, _
                      Operation:=xlNone, _
                      SkipBlanks:=False, _
                      Transpose:=False
    End With
  End With
  Application.CutCopyMode = False
  
  gwkbImport.Close SaveChanges:=False
  Application.ScreenUpdating = True

  With ThisWorkbook.Worksheets("Sheet4")
    .Range("P2", .Cells(.Rows.Count, "P").End(xlUp)).ClearContents
    .Range("S2", .Cells(.Rows.Count, "S").End(xlUp)).ClearContents
    .Range("R1").ClearContents
  End With
  Application.Goto ThisWorkbook.Worksheets("Input").Range("A1"), Scroll:=True
   
  Set gwsNewHeader = Nothing
  Set gwkbImport = Nothing
 
End Sub

Maybe due to an error in my understanding the imported cells from the loop are overwritten as headers are copied over to the area which just had been filled: You should check this and alter the code to do what you want it to do at the places needed.

The following routines all are located behind the UserForm:

VBA Code:
Private Sub UserForm_Initialize()
  Dim lngIndexWS      As Long       'index of worksheet in new workbook if more than one worksheet
  Dim lngWS           As Long       'counter for index of worksheets in opened workbook
  Dim varFile         As Variant    'variable to hold path and filename for workbook to open
  Dim varArr          As Variant    'values for the header values to be copied
  Dim wbActive        As Workbook   'workbook which is activated in Excel at start: ActiveWorkbook,
                                    'workbook holding the code: ThisWorkbook
  Dim wsSheet3        As Worksheet  'object for "Sheet3"
  Dim wsInput         As Worksheet  'object for "Input"
  Dim strWS           As String     'Holding the names of worksheets of new workbook
  Dim ws              As Worksheet  'for looping worksheets in new workbook
  Dim wb              As Workbook   'for looping through all open workbooks
  Dim blnRunOnce      As Boolean    'boolean for getting information about worksheets,
  Dim blnUnload       As Boolean    'boolean whether to unload the UF
  
  Const cstrProcName  As String = "UserForm1_Initialize"
  
  On Error GoTo err_here
  blnUnload = False
  
  Set wbActive = ThisWorkbook
  Set wsSheet3 = wbActive.Sheets("Sheet3")
  Set wsInput = wbActive.Sheets("Input")
  
  If wsInput.Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then GoTo end_here
  
  If gwkbImport Is Nothing Then
    varFile = Application.GetOpenFilename("(*.xlsx),", MultiSelect:=False)
    If varFile = False Then
      MsgBox "No file selected to import.", 48
      blnUnload = True
      GoTo end_here
    End If
    Set gwkbImport = Workbooks.Open(Filename:=varFile)
  Else
    For Each wb In Workbooks
      If wb.Name = gwkbImport.Name Then Exit For
    Next wb
    Set gwkbImport = Workbooks.Open(Filename:=gwkbImport.FullName)
  End If
 
  If gwkbImport.Worksheets.Count > 1 Then
    blnRunOnce = False
reIB:
    If blnRunOnce = False Then
      For Each ws In gwkbImport.Worksheets
        lngWS = lngWS + 1
        strWS = strWS & lngWS & " : " & ws.Name & vbCrLf
      Next ws
      blnRunOnce = True
    End If
    lngIndexWS = Application.InputBox("Enter worksheet number" & vbCrLf & Left(strWS, Len(strWS) - 1), "Worksheet selection", , , , , , 1)
    If lngIndexWS > gwkbImport.Worksheets.Count Then
      MsgBox "Invalid Worksheet Input, Try Again.", 48, "Entry Required"
      GoTo reIB
    ElseIf lngIndexWS = 0 Then
      MsgBox "Procedure cancelled", vbInformation, "Stopping here"
      gwkbImport.Close False
      Set gwkbImport = Nothing
      blnUnload = True
      GoTo end_here
    Else
      Set gwsNewHeader = gwkbImport.Worksheets(lngIndexWS)
    End If
  Else
    Set gwsNewHeader = gwkbImport.Worksheets(1)
  End If

  If blnUnload = False Then
    wsSheet3.Range("P2:P" & wsSheet3.Rows.Count).ClearContents
    varArr = gwsNewHeader.Range("A1").Resize(1, gwsNewHeader.Cells(1, Columns.Count).End(xlToLeft).Column)
    varArr = WorksheetFunction.Transpose(varArr)
    wsSheet3.Range("P2").Resize(UBound(varArr), 1).Value = varArr
    Application.Goto wsSheet3.Range("P1"), True
  End If

end_here:
  Set wsSheet3 = Nothing
  Set wsInput = Nothing
  Set wbActive = Nothing
  If blnUnload Then End
  Exit Sub

err_here:
  Debug.Print "Actual procedure name: " & cstrProcName & vbCrLf & _
              "Error number: " & Err.Number & vbCrLf & _
              "Error description: " & Err.Description
  Err.Clear
  Resume end_here

End Sub

VBA Code:
Private Sub UserForm_Activate()
  Dim wsSheet3        As Worksheet      'object for Sheet3
  Dim rng2List        As Range          'object holding range for List for CBs
  Dim objCtrl         As Control        'object to cycle through the Controls on the UF
  
  Set wsSheet3 = ThisWorkbook.Sheets("Sheet3")
  
  Set rng2List = wsSheet3.Range("P2", wsSheet3.Cells(Rows.Count, 16).End(xlUp))
  
  For Each objCtrl In Me.Controls
    If TypeOf objCtrl Is MSForms.ComboBox Then
      objCtrl.List = rng2List.Value
    End If
  Next objCtrl
  
  Application.Goto Sheets("Input").Range("A1"), True
  
  Set rng2List = Nothing
  Set wsSheet3 = Nothing
  
End Sub

You must spend some work on the next procedure as my UserForm and Controls look different from yours, as well as that I renamed the buttons. If you run into trouble here and need help just call for it:

VBA Code:
Private Sub cmdAdd_Click()
  Dim objNewLB        As Object
  Dim objNewCB        As Object
  Dim lngUFHeight     As Long
  Dim lngLR_P         As Long
  Dim lngLR_U         As Long
  Dim wsSheet3        As Worksheet
  
  Static slngAddCtrls As Long                     'number of controls added
  
  Const cblnHaHoBe    As Boolean = True           '!!!!! change to False, uncomment and adjust your code to suit
                                                  'my UserForm has other dimensions than yours, I called my Buttons
                                                  'cmdAdd and CmdProc
  
  Set wsSheet3 = ThisWorkbook.Sheets("Sheet3")

  lngLR_P = wsSheet3.Cells(wsSheet3.Rows.Count, 16).End(xlUp).Row
  lngLR_U = wsSheet3.Cells(wsSheet3.Rows.Count, 21).End(xlUp).Row

  If cblnHaHoBe Then
    'all dimensions are tailored for my sample
    slngAddCtrls = slngAddCtrls + 1
    'general height of UserForm
    Me.Height = Me.Height + (30 * slngAddCtrls)
    'start of last constant element, new ones should be listed below
    lngUFHeight = 230
    Set objNewLB = Me.Controls.Add("Forms.listbox.1", True)
    With objNewLB
      .Name = "Listbox" & slngAddCtrls
      .Left = 30
      .Height = 25
      .Width = 108
      .Top = lngUFHeight + (25 * slngAddCtrls)
      .RowSource = wsSheet3.Name & "!U10:U" & lngLR_U
    End With
    Set objNewCB = Me.Controls.Add("Forms.combobox.1", True)
    With objNewCB
      .Name = "Combobox" & slngAddCtrls
      .Left = 168
      .Height = 25
      .Width = 108
      .Top = lngUFHeight + (25 * slngAddCtrls)
      .RowSource = wsSheet3.Name & "!P2:P" & lngLR_P
    End With
    With cmdAdd
      .Left = 30
      .Top = lngUFHeight + 5 + (25 * (slngAddCtrls + 2))
    End With
    With cmdProc
      .Left = 168
      .Top = lngUFHeight + 5 + (25 * (slngAddCtrls + 2))
    End With
    With Label9
      .Left = 30
      .Top = lngUFHeight + (30 * (slngAddCtrls + 1))
      If slngAddCtrls > 0 Then
        .Caption = slngAddCtrls & " Fields Added"
      End If
    End With
  Else
'    slngAddCtrls = slngAddCtrls + 1
'    lngUFHeight = 202
'    Set objNewLB = Me.Controls.Add("Forms.listbox.1", True)
'    slngAddCtrls = slngAddCtrls + 1
'    With objNewLB
'        .Name = "Listbox" & slngAddCtrls
'        .Left = 17
'        .lngUFHeight = 20
'        .Width = 92
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'        .RowSource = "Sheet3!U10:U" & lngLR_U
'    End With
'    Set objNewCB = Me.Controls.Add("Forms.combobox.1", True)
'    lngUFHeight = 200
'    With objNewCB
'        .Name = "Combobox" & slngAddCtrls
'        .Left = 114
'        .Width = 107
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'        .RowSource = "Sheet3!P2:P" & lngLR_P
'    End With
'    lngUFHeight = 225
'    With CommandButton1
'        .Left = 30
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'    End With
'    lngUFHeight = 225
'    With CommandButton2
'        .Left = 126
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'    End With
'    lngUFHeight = 305
'    DataMap.lngUFHeight = lngUFHeight + (25 * slngAddCtrls)
'    lngUFHeight = 260
'    With Label9
'        .Caption = slngAddCtrls & " Field Added"
'        .Left = 86
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'        If slngAddCtrls > 1 Then
'            .Caption = slngAddCtrls & " Fields Added"
'        End If
'    End With
'    Me.Tag = slngAddCtrls
  End If
  
  Set wsSheet3 = Nothing

End Sub

VBA Code:
Private Sub cmdProc_Click()
  Dim lngCounter        As Long
  Dim blnComplete       As Boolean
  Dim objCtrl           As Control
  Dim objColNoDupes     As New Collection
  
  For Each objCtrl In Me.Controls
    If TypeOf objCtrl Is MSForms.ComboBox Then
      With objCtrl
        Debug.Print objCtrl.Name
        blnComplete = Len(.Value) > 0
        If blnComplete Then
          On Error Resume Next
          objColNoDupes.Add .Value, CStr(.Value)
          If Err.Number = 457 Then
            MsgBox "Item '" & .Value & "' has already been chosen, please alter and try again.", vbInformation, "Double encountered"
            .SetFocus
            Exit Sub
          End If
        Else
          MsgBox "Please fill blank field", 48, "Entry Required"
          .SetFocus
          Exit Sub
        End If
      End With
    End If
  Next objCtrl
  
  If blnComplete Then
    With ThisWorkbook.Worksheets("Sheet3")
      .Range("S2", .Range("S" & .Rows.Count).End(xlUp)).ClearContents
      For lngCounter = 1 To objColNoDupes.Count
        .Range("S" & lngCounter + 1).Value = objColNoDupes(lngCounter)
      Next lngCounter
    End With
    Unload Me
    Call DataImport
  End If

End Sub

If you have questions on the code feel free to ask - on the sample I built code ran like I expected it to do (still I don't know if I put in the correct guesses in my setup). And I placed a formular button on sheet Input and assigned macro Call_UF to it.

Lots of code. If you want you may download my sample workbook here. A word on the properties: the workbook is based on a template I created or modified at the date that is shown as Date pf creation.

Ciao,
Holger
 
Upvote 0
Hi bcmk29,

I'm still unsure about what your data looks like so I had to do some guessing.

First of all you should avoid referencing sheets or worksheets by their indexnumber - if you do not protect the structure sheets may be moved resulting in either run-time errors or unwanted results. Referring to the tab sheetnames is more reliant in my eyes as the sheets could be moved anywhere but users may change these names (resulting in run-time errors). The safest way for me is to refer to the CodeName of the sheets: it can only be altered in the VBE or by code, and most people don't even know that CodeNames exist. And it worls without problems in ThisWorkbook, teh workbook with the code. By default CodeNames will not be accepted if you refer to a differetn workbook - there's a workaround to use them anyhow.

I worked with tab sheetnames in my codes.

I inserted 2 standard modules (I actually renamed them to modStartUF and modDataImport), code for modStartUF

VBA Code:
Public gwkbImport As Workbook
Public gwsNewHeader As Worksheet
'

Sub Call_UF()

  UserForm1.Show

End Sub

Code for modDataImport:

VBA Code:
Sub DataImport()
  Dim lngImport               As Long
 
  Const cblnClearGlobals      As Boolean = False
 
  '/// This loop can be omitted as the following code overwrites some/most/all of the data
  For lngImport = 2 To ThisWorkbook.Worksheets("Sheet4").Cells(Rows.Count, 19).End(xlUp).Row
    gwsNewHeader.Range(Sheets("Sheet3").Range("T" & lngImport).Value).Copy ThisWorkbook.Worksheets("Input").Cells(1, lngImport - 1)
  Next lngImport
 
  Application.ScreenUpdating = True
  With ThisWorkbook
    .Worksheets("Sheet3").Range("A1:U1").Copy
    With .Worksheets("Input").Range("A1").Resize(1, 21)
        .PasteSpecial Paste:=xlPasteValues, _
                      Operation:=xlNone, _
                      SkipBlanks:=False, _
                      Transpose:=False
        .PasteSpecial Paste:=xlPasteFormats, _
                      Operation:=xlNone, _
                      SkipBlanks:=False, _
                      Transpose:=False
    End With
  End With
  Application.CutCopyMode = False
 
  gwkbImport.Close SaveChanges:=False
  Application.ScreenUpdating = True

  With ThisWorkbook.Worksheets("Sheet4")
    .Range("P2", .Cells(.Rows.Count, "P").End(xlUp)).ClearContents
    .Range("S2", .Cells(.Rows.Count, "S").End(xlUp)).ClearContents
    .Range("R1").ClearContents
  End With
  Application.Goto ThisWorkbook.Worksheets("Input").Range("A1"), Scroll:=True
  
  Set gwsNewHeader = Nothing
  Set gwkbImport = Nothing
 
End Sub

Maybe due to an error in my understanding the imported cells from the loop are overwritten as headers are copied over to the area which just had been filled: You should check this and alter the code to do what you want it to do at the places needed.

The following routines all are located behind the UserForm:

VBA Code:
Private Sub UserForm_Initialize()
  Dim lngIndexWS      As Long       'index of worksheet in new workbook if more than one worksheet
  Dim lngWS           As Long       'counter for index of worksheets in opened workbook
  Dim varFile         As Variant    'variable to hold path and filename for workbook to open
  Dim varArr          As Variant    'values for the header values to be copied
  Dim wbActive        As Workbook   'workbook which is activated in Excel at start: ActiveWorkbook,
                                    'workbook holding the code: ThisWorkbook
  Dim wsSheet3        As Worksheet  'object for "Sheet3"
  Dim wsInput         As Worksheet  'object for "Input"
  Dim strWS           As String     'Holding the names of worksheets of new workbook
  Dim ws              As Worksheet  'for looping worksheets in new workbook
  Dim wb              As Workbook   'for looping through all open workbooks
  Dim blnRunOnce      As Boolean    'boolean for getting information about worksheets,
  Dim blnUnload       As Boolean    'boolean whether to unload the UF
 
  Const cstrProcName  As String = "UserForm1_Initialize"
 
  On Error GoTo err_here
  blnUnload = False
 
  Set wbActive = ThisWorkbook
  Set wsSheet3 = wbActive.Sheets("Sheet3")
  Set wsInput = wbActive.Sheets("Input")
 
  If wsInput.Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then GoTo end_here
 
  If gwkbImport Is Nothing Then
    varFile = Application.GetOpenFilename("(*.xlsx),", MultiSelect:=False)
    If varFile = False Then
      MsgBox "No file selected to import.", 48
      blnUnload = True
      GoTo end_here
    End If
    Set gwkbImport = Workbooks.Open(Filename:=varFile)
  Else
    For Each wb In Workbooks
      If wb.Name = gwkbImport.Name Then Exit For
    Next wb
    Set gwkbImport = Workbooks.Open(Filename:=gwkbImport.FullName)
  End If
 
  If gwkbImport.Worksheets.Count > 1 Then
    blnRunOnce = False
reIB:
    If blnRunOnce = False Then
      For Each ws In gwkbImport.Worksheets
        lngWS = lngWS + 1
        strWS = strWS & lngWS & " : " & ws.Name & vbCrLf
      Next ws
      blnRunOnce = True
    End If
    lngIndexWS = Application.InputBox("Enter worksheet number" & vbCrLf & Left(strWS, Len(strWS) - 1), "Worksheet selection", , , , , , 1)
    If lngIndexWS > gwkbImport.Worksheets.Count Then
      MsgBox "Invalid Worksheet Input, Try Again.", 48, "Entry Required"
      GoTo reIB
    ElseIf lngIndexWS = 0 Then
      MsgBox "Procedure cancelled", vbInformation, "Stopping here"
      gwkbImport.Close False
      Set gwkbImport = Nothing
      blnUnload = True
      GoTo end_here
    Else
      Set gwsNewHeader = gwkbImport.Worksheets(lngIndexWS)
    End If
  Else
    Set gwsNewHeader = gwkbImport.Worksheets(1)
  End If

  If blnUnload = False Then
    wsSheet3.Range("P2:P" & wsSheet3.Rows.Count).ClearContents
    varArr = gwsNewHeader.Range("A1").Resize(1, gwsNewHeader.Cells(1, Columns.Count).End(xlToLeft).Column)
    varArr = WorksheetFunction.Transpose(varArr)
    wsSheet3.Range("P2").Resize(UBound(varArr), 1).Value = varArr
    Application.Goto wsSheet3.Range("P1"), True
  End If

end_here:
  Set wsSheet3 = Nothing
  Set wsInput = Nothing
  Set wbActive = Nothing
  If blnUnload Then End
  Exit Sub

err_here:
  Debug.Print "Actual procedure name: " & cstrProcName & vbCrLf & _
              "Error number: " & Err.Number & vbCrLf & _
              "Error description: " & Err.Description
  Err.Clear
  Resume end_here

End Sub

VBA Code:
Private Sub UserForm_Activate()
  Dim wsSheet3        As Worksheet      'object for Sheet3
  Dim rng2List        As Range          'object holding range for List for CBs
  Dim objCtrl         As Control        'object to cycle through the Controls on the UF
 
  Set wsSheet3 = ThisWorkbook.Sheets("Sheet3")
 
  Set rng2List = wsSheet3.Range("P2", wsSheet3.Cells(Rows.Count, 16).End(xlUp))
 
  For Each objCtrl In Me.Controls
    If TypeOf objCtrl Is MSForms.ComboBox Then
      objCtrl.List = rng2List.Value
    End If
  Next objCtrl
 
  Application.Goto Sheets("Input").Range("A1"), True
 
  Set rng2List = Nothing
  Set wsSheet3 = Nothing
 
End Sub

You must spend some work on the next procedure as my UserForm and Controls look different from yours, as well as that I renamed the buttons. If you run into trouble here and need help just call for it:

VBA Code:
Private Sub cmdAdd_Click()
  Dim objNewLB        As Object
  Dim objNewCB        As Object
  Dim lngUFHeight     As Long
  Dim lngLR_P         As Long
  Dim lngLR_U         As Long
  Dim wsSheet3        As Worksheet
 
  Static slngAddCtrls As Long                     'number of controls added
 
  Const cblnHaHoBe    As Boolean = True           '!!!!! change to False, uncomment and adjust your code to suit
                                                  'my UserForm has other dimensions than yours, I called my Buttons
                                                  'cmdAdd and CmdProc
 
  Set wsSheet3 = ThisWorkbook.Sheets("Sheet3")

  lngLR_P = wsSheet3.Cells(wsSheet3.Rows.Count, 16).End(xlUp).Row
  lngLR_U = wsSheet3.Cells(wsSheet3.Rows.Count, 21).End(xlUp).Row

  If cblnHaHoBe Then
    'all dimensions are tailored for my sample
    slngAddCtrls = slngAddCtrls + 1
    'general height of UserForm
    Me.Height = Me.Height + (30 * slngAddCtrls)
    'start of last constant element, new ones should be listed below
    lngUFHeight = 230
    Set objNewLB = Me.Controls.Add("Forms.listbox.1", True)
    With objNewLB
      .Name = "Listbox" & slngAddCtrls
      .Left = 30
      .Height = 25
      .Width = 108
      .Top = lngUFHeight + (25 * slngAddCtrls)
      .RowSource = wsSheet3.Name & "!U10:U" & lngLR_U
    End With
    Set objNewCB = Me.Controls.Add("Forms.combobox.1", True)
    With objNewCB
      .Name = "Combobox" & slngAddCtrls
      .Left = 168
      .Height = 25
      .Width = 108
      .Top = lngUFHeight + (25 * slngAddCtrls)
      .RowSource = wsSheet3.Name & "!P2:P" & lngLR_P
    End With
    With cmdAdd
      .Left = 30
      .Top = lngUFHeight + 5 + (25 * (slngAddCtrls + 2))
    End With
    With cmdProc
      .Left = 168
      .Top = lngUFHeight + 5 + (25 * (slngAddCtrls + 2))
    End With
    With Label9
      .Left = 30
      .Top = lngUFHeight + (30 * (slngAddCtrls + 1))
      If slngAddCtrls > 0 Then
        .Caption = slngAddCtrls & " Fields Added"
      End If
    End With
  Else
'    slngAddCtrls = slngAddCtrls + 1
'    lngUFHeight = 202
'    Set objNewLB = Me.Controls.Add("Forms.listbox.1", True)
'    slngAddCtrls = slngAddCtrls + 1
'    With objNewLB
'        .Name = "Listbox" & slngAddCtrls
'        .Left = 17
'        .lngUFHeight = 20
'        .Width = 92
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'        .RowSource = "Sheet3!U10:U" & lngLR_U
'    End With
'    Set objNewCB = Me.Controls.Add("Forms.combobox.1", True)
'    lngUFHeight = 200
'    With objNewCB
'        .Name = "Combobox" & slngAddCtrls
'        .Left = 114
'        .Width = 107
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'        .RowSource = "Sheet3!P2:P" & lngLR_P
'    End With
'    lngUFHeight = 225
'    With CommandButton1
'        .Left = 30
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'    End With
'    lngUFHeight = 225
'    With CommandButton2
'        .Left = 126
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'    End With
'    lngUFHeight = 305
'    DataMap.lngUFHeight = lngUFHeight + (25 * slngAddCtrls)
'    lngUFHeight = 260
'    With Label9
'        .Caption = slngAddCtrls & " Field Added"
'        .Left = 86
'        .Top = lngUFHeight + (25 * slngAddCtrls)
'        If slngAddCtrls > 1 Then
'            .Caption = slngAddCtrls & " Fields Added"
'        End If
'    End With
'    Me.Tag = slngAddCtrls
  End If
 
  Set wsSheet3 = Nothing

End Sub

VBA Code:
Private Sub cmdProc_Click()
  Dim lngCounter        As Long
  Dim blnComplete       As Boolean
  Dim objCtrl           As Control
  Dim objColNoDupes     As New Collection
 
  For Each objCtrl In Me.Controls
    If TypeOf objCtrl Is MSForms.ComboBox Then
      With objCtrl
        Debug.Print objCtrl.Name
        blnComplete = Len(.Value) > 0
        If blnComplete Then
          On Error Resume Next
          objColNoDupes.Add .Value, CStr(.Value)
          If Err.Number = 457 Then
            MsgBox "Item '" & .Value & "' has already been chosen, please alter and try again.", vbInformation, "Double encountered"
            .SetFocus
            Exit Sub
          End If
        Else
          MsgBox "Please fill blank field", 48, "Entry Required"
          .SetFocus
          Exit Sub
        End If
      End With
    End If
  Next objCtrl
 
  If blnComplete Then
    With ThisWorkbook.Worksheets("Sheet3")
      .Range("S2", .Range("S" & .Rows.Count).End(xlUp)).ClearContents
      For lngCounter = 1 To objColNoDupes.Count
        .Range("S" & lngCounter + 1).Value = objColNoDupes(lngCounter)
      Next lngCounter
    End With
    Unload Me
    Call DataImport
  End If

End Sub

If you have questions on the code feel free to ask - on the sample I built code ran like I expected it to do (still I don't know if I put in the correct guesses in my setup). And I placed a formular button on sheet Input and assigned macro Call_UF to it.

Lots of code. If you want you may download my sample workbook here. A word on the properties: the workbook is based on a template I created or modified at the date that is shown as Date pf creation.

Ciao,
Holger
Holger,

Thanks for taking the time to revamp my code. I ended up receiving "Run-time error '424':" Object required for the below line of code.

VBA Code:
gwsNewHeader.Range(Sheets("Sheet3").Range("T" & lngImport).Value).Copy ThisWorkbook.Worksheets("Input").Cells(1, lngImport - 1)
 
Upvote 0
Hi bcmk29,

please do me a favour and stop quoting full posts.

In Post #12 I asked

In my sample the first code ran without errors but I would need further information for the second UF - what triggers the code, if this part of code
VBA Code:
       ...Range(Sheets("Sheet3").Range("T" & lngImport).Value)...
means using the Indirect Function via VBA...

I'm still waiting for an answer from your side as that was one of the guesses I had to make in my sample in order to make my code work.

Ciao,
Holger
 
Upvote 0
Hi bcmk29,

from starting the UserForm another workbook is opened and public objects are set to the workbook as well as the sheet chosen. Directly after running the proceed button the code is called that meaning both workbooks are open. At the end of DataImport the public variables will be destroyed. I slightly restructured the code to check if gwsNewHeader still if assigned to a worksheet and introduced objects for the sheets mentioned and located in ThisWorkbook. I'm not sure the error will disappear but after this change the code will only run if called from UserForm1:

VBA Code:
Sub DataImport()
  Dim lngImport     As Long
  Dim wsSheet3      As Worksheet
  Dim wsSheet4      As Worksheet
  Dim wsInput       As Worksheet
  
  Set wsSheet3 = ThisWorkbook.Sheets("Sheet3")
  Set wsSheet4 = ThisWorkbook.Sheets("Sheet4")
  Set wsInput = ThisWorkbook.Sheets("Input")
  
  If Not gwsNewHeader Is Nothing Then
    '/// This loop can be omitted as the following code overwrites some/most/all of the data
    For lngImport = 2 To wsSheet4.Cells(Rows.Count, 19).End(xlUp).Row
      gwsNewHeader.Range(wsSheet3.Range("T" & lngImport).Value).Copy wsInput.Cells(1, lngImport - 1)
    Next lngImport
 
    Application.ScreenUpdating = True
    wsSheet3.Range("A1:U1").Copy
    With wsInput.Range("A1").Resize(1, 21)
        .PasteSpecial Paste:=xlPasteValues, _
                      Operation:=xlNone, _
                      SkipBlanks:=False, _
                      Transpose:=False
        .PasteSpecial Paste:=xlPasteFormats, _
                      Operation:=xlNone, _
                      SkipBlanks:=False, _
                      Transpose:=False
    End With
    Application.CutCopyMode = False
    
    gwkbImport.Close SaveChanges:=False
    Application.ScreenUpdating = True
  
    With ThisWorkbook.Worksheets("Sheet4")
      .Range("P2", .Cells(.Rows.Count, "P").End(xlUp)).ClearContents
      .Range("S2", .Cells(.Rows.Count, "S").End(xlUp)).ClearContents
      .Range("R1").ClearContents
    End With
  End If
  Application.Goto ThisWorkbook.Worksheets("Input").Range("A1"), Scroll:=True
   
  Set wsInput = ThisWorkbook.Sheets("Input")
  Set wsSheet4 = ThisWorkbook.Sheets("Sheet4")
  Set wsSheet3 = ThisWorkbook.Sheets("Sheet3")
  Set gwsNewHeader = Nothing
  Set gwkbImport = Nothing
 
End Sub
 
Upvote 0
Hi bmck29,

me again. The reason for the error might be what is stored in Column T on Sheet3. As you can see in my sample I put in cell addresses there but I'm afraid I don't know what data is stored in your workbook.

And you reported an error - did you run the code in your version (did you use the updated code) or my sample as I can't figure that out by now. If it's my sample I'll have some time to spend on it in order to find the reason for the error.

Ciao,
Holger
 
Upvote 0
Hi bmck29,

me again. The reason for the error might be what is stored in Column T on Sheet3. As you can see in my sample I put in cell addresses there but I'm afraid I don't know what data is stored in your workbook.

And you reported an error - did you run the code in your version (did you use the updated code) or my sample as I can't figure that out by now. If it's my sample I'll have some time to spend on it in order to find the reason for the error.

Ciao,
Holger
Hi Holger,

I'm just replying to your response individually not sure why it quotes full posts.
Column T sheet3 has the range mentioned (A:A).

I've updated your sample file with headers, and sheet names, and below is the link containing files along with sample data for you to work on. I know I might not have handled the coding how it should have been. Thanks for your patience and for helping me with this.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top