Hi All,
I have a problem with my code (which was ok until now). I got a Run-time error 91 message all the time when I am running the following code:
Sub matchReport()
Dim id As String
Dim cmo_fmo As String
Dim last_row, j As Integer
Dim FileName As String
' get last row of this workbook
last_row = ActiveSheet.UsedRange.Rows.Count + 1
Set Source = Workbooks.Open("k:\SDM Reporting\Reporting_BUD\EON_C\Report block\Ready reports\MCC_Tools\Gabor\Exh 3-A MCC 3.2.05 Office LAN WLAN Availability 2013.xlsx")
j = 2
Do While (Source.Sheets("Raw data").Cells(j, 1).Value <> "")
' get values from source
id = Source.Sheets("Raw data").Cells(j, 1).Value
cmo_fmo = Source.Sheets("Raw data").Cells(j, 4).Value
'find id
ThisWorkbook.Activate
Columns("E:E").Select
Set cell = Selection.Find(What:=id, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
ActiveSheet.Cells(cell.Row, 4).Value = cmo_fmo 'the issue is here
j = j + 1
Loop
Source.Close
Columns("F:F").Select
Selection.NumberFormat = "0.00%"
Columns("H:K").Select
Selection.NumberFormat = ""
'MSGbox
ActiveCell = MsgBox("Format procedure has been finished.", vbOKOnly, "Format has been finished in Weekly Report")
End Sub
Do you have any ideas why this is happening now? I have not changed the code only I have refreshed the raw data file, source is the same as before.
Thank you in advance!
Bookmarks