Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 166
- Office Version
- 2010
- Platform
- 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
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