0

I am getting a different RowNumber whenever I run my code.

Dim idRowCount As Long

idRowCount = Worksheets("MasterFile").Range("B:B").Cells.SpecialCells(xlCellTypeConstants).Count  

Range("R2").Copy
Range("R3:R" & idRowCount).PasteSpecial xlPasteFormulas

The total RowCount should be 325,000 but sometimes it only paste the formulas up to 180,000 or 150,000 cell row.

Is there anything wrong with my code or declaration?

I have already tried to paste the count value on a Range of cell and it gives the right number of constant value 325,000. I also tried to temporarily replace the variable 'idRowCount' with the number 300,000 but it returns(paste) on different row number.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
jjacker
  • 21
  • 1
  • Are you perhaps trying to find the last row? Please see the approach outlined [here](https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-excel-with-vba). – BigBen Jun 11 '19 at 13:57
  • Thanks for quick response @BigBen, but i left the lastRow looping formula for my project 'coz it takes time to load the procedure as it runs through each cell. Since i have constant worksheet formula, I decided to use the copy paste formula instead. But yeah, i'm getting this unknown return value. :( – jjacker Jun 11 '19 at 14:04

0 Answers0