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.
Sub Deviation_Macro() Dim NewDataRng As Range 'For Sheet1 Dim Cel As Range 'For Sheet1 Dim OldDataRng As Range 'For GS_GP_DEV_TOTAL_N_00000 Dim MatchingValueCell As Range 'For GS_GP_DEV_TOTAL_N_00000 Dim LastRow As Long Dim wb As Workbook Dim ws As Worksheet Dim FoundCell As Range Set wb = ActiveWorkbook Set ws = ActiveSheet Application.ScreenUpdating = False Const WHAT_TO_FIND As String = "Previous RRD Periods" Dim frai As Integer 'Found row as Int Set frai = FoundCell.Row + 2 Rows("frai:frai").Select ActiveWindow.FreezePanes = True With Sheets("Sheet1") LastRow = .Cells(Rows.Count, 1).End(xlUp).Row Set NewDataRng = .Range("F" & frai:F" & CStr(LastRow)) End With With Sheets("For GS_GP_DEV_TOTAL_N_00000") LastRow = .Cells(Rows.Count, 1).End(xlUp).Row Set OldDataRng = .Range("F" & frai:F" & CStr(LastRow)) End With For Each Cel In NewDataRng Set MatchingValueCell = OldDataRng.Find(What:=Cel.Value, _ After:=OldDataRng.Cells(OldDataRng.Cells.Count)) If Not MatchingValueCell Is Nothing Then _ Cel.Resize(11, 15).Copy MatchingValueCell Next Cel Application.ScreenUpdating = True End Sub
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.
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.