I have written a macro in a sheet "A" ,
on change in sheet A , i want to copy a range from sheet "C" and paste in sheet "D"
This flow is fine ,and I am able to acheive it . The problem is when I am trying to select the range in sheet B.
rownum= 83 (I get it dynamically)
colnum = 31 (Number of columns in rownum)
Now I want to copy the 83rd Row till 31st column.
Problem Begins :
Sheets("B").Range("A83:AO83").Select ~ works like Charm
As the above is not dynamic ,I want to use
Sheets("B").Range(Cells(rownum,1),Cells(rownum,colnum)).Select ~ Object Defined Error
Any Ideas !!! I am stuck like for 2 hrs.. its not happening .
This is some part of code , to cause less confusion , I am not posting all the code , The code stops at the last line !! OBJECT DEFINED ERROR .
Dim rownum As Integer
Dim colnum As Integer
rownum = Application.Match(searchFE, Sheets("Attendance").Range("D:D"), 0)
colnum = Cells(rownum, Columns.Count).End(xlToLeft).Column
Sheets("Attendance").Range(Cells(rownum, 1), Cells(rownum, colnum)).Select
both rownum and colnum are getting values .