roypabitra
Member
Respected Sir,
I have the following code which previously worked perfectly but now I got the Run time error 13 Type Mismatch. Please help me how to solve
Thanks & Regards
Pabitra Roy
I have the following code which previously worked perfectly but now I got the Run time error 13 Type Mismatch. Please help me how to solve
Code:
Sub copy_paste_data_from_one_sheet_to_another1()
'Let's start at row 2. Row 1 has headers
x = 9
Dim myName As String
Dim myNameF As String
Dim cPart As Range
Dim wk3 As Worksheet
Dim wk4 As Worksheet
Dim i As Range
Dim i2 As Range
Dim oCol As Long
'Dim nextRow As Long
'Dim oCol As Long
'Dim myCopy As Range
'Dim myTest As Range
'Dim myTest1 As Range
'Set inputWks = Worksheets("Input")
'Set historyWks = Worksheets("KOLKATA")
Set wk3 = Worksheets("ledger")
Set wk4 = Worksheets("Pmt")
wk4.Activate
'LastRow = Range("D65536").End(xlUp).Row + 1
Range("A10" & ":L65536").ClearContents
wk3.Activate
Application.CutCopyMode = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveSheet.Range("A10:L19999").Value = ActiveSheet.Range("A10:L19999").Value
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayAlerts = True
wk4.Activate
myNameF = wk4.Range("inputt")
myName = UCase(myNameF)
'Start the loop
Do While Cells(x, 8) <> ""
'Look for name
If Cells(x, 8) = myName Then
'copy the row if it contains 'myName'
wk3.Rows(x).Copy
'Go to sheet2. Activate it. We want the data here
wk4.Activate
'Find the first empty row in sheet2
erow = wk4.Cells(Rows.Count, 7).End(xlUp).Offset(1, 0).Row
'Paste the data here
Application.DisplayAlerts = False
ActiveSheet.Paste Destination:=wk4.Rows(erow)
End If
'go to sheet1 again and actvate it
wk3.Activate
'Loop through the other rows with data
x = x + 1
Loop
wk3.Activate
Range("a5:L5").Select
Range(Selection, Selection.End(xlToRight)).Select
'Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
'Workbooks.Add
Range("a10:A19999").Select
ActiveSheet.Paste
wk4.Activate
End Sub
Pabitra Roy