Hi,
I have added a button that is suppose to select the data from another file and copy and paste in the selected month on the userform, but I am getting the error listed in the title "Runtime Error - Type mismatch error. I don't know if the that how to correct this error. It errors out at the area highlighted in red, this is where I name each sheet. I would type the name in B1 and the sheetname will change. The move sheet code I'll also include this work up to the point where the data must be paste on the new sheet base on the selection, then it won't paste and I receive the error. My deadline is by Thursday and I must test this week, please help
Nika
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Flag Then Exit Sub
'Call FindNewLoans
' If Target = Worksheets(frmFindLoanInfo.cmbMnthClaim.Value) Then
If Target = Range("B1") Then
ActiveSheet.Name = Range("B1").Value
End If
End Sub
Private Sub MoveSheets()
Dim vFileNames As String
vFileNames = ThisWorkbook.Name
Application.ScreenUpdating = False
Workbooks.Open Filename:="\\C:\Users\FHCCU\Documents\MicroLoanExtractCommission.xls" 'origin:= _
xlWindows
Range("a1:bp1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
'Windows("Workbook1.xlsx").Activate
Application.Wait Now + TimeValue("00:00:05")
'Windows("MicroLoanExtractCommission").Activate
'Sheets("Sheet1").Select
'Sheets("MicroLoanExtractCommission").Select
Workbooks(vFileNames).Activate
Range("v6:ck6").Select
'Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Sheets("Dec_2012").Copy Before:=Workbooks("MicroLoanTest.xlsm").Sheets(1)
ActiveWorkbook.Save
End Sub
Bookmarks