Convert the row number of a range to an int or long

  • I need to convert the row of a cell I found to an integer or long so I can use it to freeze the cells below and copy/paste cells from another sheet to the 11th-15th column which are comments and updates.

    Currently, Previous RRD Periods is found in row 29 (tested by printing the row)
    I need to this to be a number so I can freeze the cells placed 2 below and everything above that. Rows 1-30 should be frozen.

    Not sure how to get the following code to be an integer to freeze the cells.

    Set frai = FoundCell.Row + 2

    Then I need to copy the content from Sheet1 (which has been c/p from another document) and check if the values in F match. If they do match then I need to copy the 11th-15th column and paste into my main sheet.
    If possible, I want to make sure that it skips columns that contain the text "Result" and "Overall Result" (These two columns are also merged)
    When pasting information over, I want the format to copy over as well.

    Not sure if this is how I would get this to work. Basically it would be cell F29:F for my case. Sheet GS_GP_DEV_TOTAL_N_00000 starts on F29 and Sheet1 starts on F9 for the checking. It may not be the same row everytime but the format will remain the same. I don't want the cells in GS_... to change but I do want it to check with all rows in the other document to look for a match in the F column.

    Set NewDataRng = .Range("F" & frai:F" & CStr(LastRow))

    Thank you!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!