kindly help me to resolve getting this error
Compile error for without next vba
Compile error for without next vba
VBA Code:
Sub DataRefine()
Dim MyFolder As String
Dim MyFile As String
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim iRow As Long
Set ws1 = ThisWorkbook.Worksheets("Data")
Set ws2 = ThisWorkbook.Worksheets("Dash")
MyFolder = "C:\****"
MyFile = Dir(MyFolder & "\*.xls")
Do While MyFile <> ""
Workbooks.Open Filename:=MyFolder & "\" & MyFile
MyFile = Dir
Loop
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
With ws1
Workbooks.Open "C:\****"\Downloads\C****".xlsx"
Sheets("Sheet0").Range("A2:W2099").Copy
Application.DisplayAlerts = False
Workbooks("****".xlsm").Sheets("Data").Range("C2:BJ1900").PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
Range("A1").Select
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Columns("B:B").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End With
Application.ScreenUpdating = True
With ws2
Sheets("Dash").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
End With
Workbooks("Car state.xlsx").Close SaveChanges:=False
End Sub