Export all Variables of 1 Moudle to Excel Area

Excelpromax123

Board Regular
Joined
Sep 2, 2021
Messages
166
Office Version
  1. 2010
Platform
  1. Windows
Hello everyone. I need a piece of code to output all the variables to the excel area of a Module . If the variable has the same name, only take 1 time (case sensitive). Thank you very much

1632221096180.png


Code:
Sub Test()
On Error Resume Next
Dim sArr(), dArr(), Dk1 As String, i As Long, K As Long, R As Long, Col As Long
Dk1 = Sheets("inhoadon").Range("AB12").Value
sArr = Range("B8:G5007").Value
R = UBound(sArr)
ReDim dArr(1 To R, 1 To 6)
For i = 1 To R
    If sArr(i, 1) <> Dk1 Then
        K = K + 1
        For Col = 1 To 6
            dArr(K, Col) = sArr(i, Col)
        Next Col
    End If
Next i
Range("B8:G5007").ClearContents
Range("B8").Resize(K, 6) = dArr
End Sub


Sub Test2()
Dim i As Long, K As Long, R As Long, Col As Long, A As Long, B As Long
MsgBox (i)
MsgBox (K)
End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,213,528
Messages
6,114,154
Members
448,553
Latest member
slaytonpa

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