Hello. I am new to VBA coding and have never worked with creating a Macro prior to this. Any assistance would be greatly appreciated.
I have a Excel sheet that is named Flight Log Tracker and I would like the sheet to automatically insert a row when the value in AU column is "Y". The inserted row has a range of A:BD. Also, I need the new inserted cell in column AO to contain the following formula; =ROUNDUP((BC31-INT(BC31))*24,1). This example is for cell AO31.
Below is my attempt at the code.
Dim I As Long
Dim LASTROW As Long
LASTROW = Cell(Row.Count,1).End(xlUp).Row
For i=LASTROW To 1 Step -1
If InStr(Range("AU" & i).Value = "Y" Then
Range("A:BD" & i).EntireRow.Insert
Shift:xlDown
Range("AO" & i).Value = "Y"
Range("AO" & i).Offest (0,1).Formula = "ROUNDUP (("BC" & i)-INT("BC" & i))
End If
Next I
End Sub
Any assistance would be grateful. Thank you for your time in helping me with my problem.
I have a Excel sheet that is named Flight Log Tracker and I would like the sheet to automatically insert a row when the value in AU column is "Y". The inserted row has a range of A:BD. Also, I need the new inserted cell in column AO to contain the following formula; =ROUNDUP((BC31-INT(BC31))*24,1). This example is for cell AO31.
Below is my attempt at the code.
Dim I As Long
Dim LASTROW As Long
LASTROW = Cell(Row.Count,1).End(xlUp).Row
For i=LASTROW To 1 Step -1
If InStr(Range("AU" & i).Value = "Y" Then
Range("A:BD" & i).EntireRow.Insert
Shift:xlDown
Range("AO" & i).Value = "Y"
Range("AO" & i).Offest (0,1).Formula = "ROUNDUP (("BC" & i)-INT("BC" & i))
End If
Next I
End Sub
Any assistance would be grateful. Thank you for your time in helping me with my problem.