title: Not Able to Select a Range in Excel VBA
body: <p>I have written a macro in a sheet "A" ,</p>
  
  <p>on change in  sheet A , i want to copy a range from sheet "C" and paste in sheet "D"</p>
  
  <p>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.</p>
  
  <pre><code>rownum= 83 (I get it dynamically)
  
  colnum = 31 (Number of columns in rownum)
  </code></pre>
  
  <p>Now I want to copy the 83rd Row till 31st column.</p>
  
  <p>Problem Begins :</p>
  
  <pre><code> Sheets("B").Range("A83:AO83").Select   ~ works like Charm 
  </code></pre>
  
  <p>As the above is not dynamic ,I want to use </p>
  
  <pre><code>Sheets("B").Range(Cells(rownum,1),Cells(rownum,colnum)).Select  ~ Object Defined Error
  </code></pre>
  
  <p>Any Ideas !!! I am stuck like for 2 hrs.. its not happening .</p>
  
  <p>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 .</p>
  
  <pre><code>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
  </code></pre>
  
  <p>both  rownum and colnum are getting values .</p>