Code:
Sub searchval()
Dim Val As String
Dim lngLastRow As Long
Dim strRowNoList As String
Dim strColNoList As String
Dim i As Integer
Val = "a"
lngLastRow = Cells(Rows.Count, "A").End(xlUp).row
For Each cell In Range("A2:A" & lngLastRow)
If cell.Text = Val Then
If strRowNoList = "" Then
strRowNoList = strRowNoList & cell.row
Else
strRowNoList = strRowNoList & cell.row
i = CInt(strRowNoList)
ActiveWorkbook.Names.Add Name:="a", RefersToR1C1:="=Sheet1!R&i&C1"
End If
End If
Next cell
'MsgBox strRowNoList
End Sub
--- this workfine but i need to create name range as dynamic row number is given.. please help me on this..
Mod Edit: Question moved to a separate thread, code tags added.
Last edited by a moderator: