Hi experts
need helping to run this code . when put number the column into inputbox to filter and split data . it gives error mismatch in this line
i no know what means theses lines
it seems the problem from them
this is the whole code
my data starts from A1: F
any help I'm so begginer
need helping to run this code . when put number the column into inputbox to filter and split data . it gives error mismatch in this line
VBA Code:
rg2.Value = rg2.Value + 1
Code:
Set rg1 = sh1.Range("A8")
Set rg2 = sh1.Range("C4")
this is the whole code
Code:
Sub parse_data()
Dim sh1 As Worksheet, rg1 As Range, rg2 As Range
Dim vcol As Variant, ky As Variant, i As Long
Dim dic As Object, sName As String
Application.ScreenUpdating = False
vcol = Application.InputBox(prompt:="Which column would you like to filter by?", Title:="Filter column", Default:="10", Type:=1)
If vcol = "" Or vcol = False Then Exit Sub
Set dic = CreateObject("Scripting.Dictionary")
Set sh1 = ActiveSheet
Set rg1 = sh1.Range("A8")
Set rg2 = sh1.Range("C4")
If sh1.AutoFilterMode Then sh1.AutoFilterMode = False
For i = rg1.Row + 1 To sh1.Cells(Rows.Count, vcol).End(3).Row
dic(sh1.Cells(i, vcol).Value) = Empty
Next
For Each ky In dic.keys
sh1.Range(rg1, sh1.Cells(Rows.Count, vcol).End(3)).AutoFilter vcol, ky
rg2.Value = rg2.Value + 1
sName = rg2.Value & " " & ky
If Not Evaluate("=ISREF('" & sName & "'!A1)") Then
Sheets.Add(After:=Sheets(Sheets.Count)).Name = sName
Else
Sheets(sName).Move After:=Worksheets(Worksheets.Count)
End If
sh1.Range("A1", sh1.Range("A" & Rows.Count).End(3)).EntireRow.Copy Sheets(sName).Range("A1")
Next
sh1.Activate
sh1.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
any help I'm so begginer