shiva_reshs
Board Regular
- Joined
- Sep 5, 2012
- Messages
- 68
Hi,
I wrote below code which helps me to find header and update the formula in the cell value. But i need little tweak where formula be changed if the header is found in Column J instead of column I. Please advose
I wrote below code which helps me to find header and update the formula in the cell value. But i need little tweak where formula be changed if the header is found in Column J instead of column I. Please advose
Code:
Sub CopyColumnByTitle()'Find "Name" in Row 1
With Sheets("Week1").Rows(12)
Set t = .Find("Total", lookat:=xlPart)
If Not t Is Nothing Then
Dim i As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Range("B" & i).Value <> "" Then
Range("t" & i).Formula = "=RC[-3]+RC[-2]+RC[-1]"
End If
End Sub