The error message was “Object variable or with block variable not set:
And therefore, I have tried to insert set but still did not work. I do not know if I will face any other problem in the server bath, security option or any other area
Code:
Sub getvalues()
Dim Path As String, Myrange As Range, ShName As Worksheet, Wb As Workbook
Set MyObject = Sheets(1) which name should I have here?
Path = "\\aramco.com\data\ir\er&t\T&CD\ITD\crwrtd\JTS\JTS _Common\IAA\[Report-1c-Server.xlsx"
Wb = Path & "\filename.xlsx"
Myrange = "A9:R7915"
Select Case ActiveSheet.Cells(6, "C")
Case 7
ShName = Sheets("July-Data")
ActiveSheet.Cells(21, "C") = Application.VLookup(F5, Wb.ShName.Myrange, 5, False)
Case 8
ShName = Sheets("Aug-Data")
ActiveSheet.Cells(21, "C") = Application.VLookup(F5, Wb.ShName.Myrange, 5, False)
Case 9
ShName = Sheets("Sep-Data")
ActiveSheet.Cells(21, "C") = Application.VLookup(F5, Wb.ShName.Myrange, 5, False)
Case Else
End Select
End Sub