hi guys i am totally new to vba , i’m trying to set the value of a cell with one of the function parameters. The code is giving an error 91. the 6th line in the code is raising the error. I’m unable to resolve it , please can anybody help me .
Thanks in advance.
Sub report_file(a, r_row)
Dim wb_dst As Workbook
Dim ws_dst As Worksheet
Set wb_dst = Workbooks.Open("F:\Projects\vba_excel\report.xlsx")
ws_dst = wb_dst.Sheets(1)
ws_dst.Cells(r_row, 2).Value =a
End Sub
The error line is.
ws_dst.Cells(r_row, 2).Value =a
Option Explicit
Sub report_file(a, r_row)
Dim wb_dst As Workbook
Dim ws_dst As Worksheet
Set wb_dst = Workbooks.Open("F:\Projects\vba_excel\report.xlsx")
Set ws_dst = wb_dst.Sheets(1)
ws_dst.Cells(r_row, 2).Value = a
If a = "savior" Then
wb_dst.Cells(r_row, 2).Value = a
End If
End Sub
Tags: excelexcel, object