Further to the comments, is this what you are trying?
Sub Sample()
Dim ws As Worksheet
Dim lCol As Long, rw As Long
'~~> Change this to the relevant worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
rw = 2 '<~~ Known row
'~~> Find the last column which has data in that row
lCol = .Cells(rw, .Columns.Count).End(xlToLeft).Column
'~~> Address of known row which has data
Debug.Print .Range("A" & rw & ":" & ReturnName(lCol) & rw).Address
End With
End Sub
'~~> Function to return Column letter from column number
Function ReturnName(ByVal num As Integer) As String
ReturnName = Split(Cells(, num).Address, "$")(1)
End Function
And if you want to set it as a range then like this
Sub Sample()
Dim ws As Worksheet
Dim lCol As Long, rw As Long
Dim rng As Range
Dim sAddress As String
'~~> Change this to the relevant worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
rw = 2 '<~~ Known row
'~~> Find the last column which has data in that row
lCol = .Cells(rw, .Columns.Count).End(xlToLeft).Column
'~~> Address of known row which has data
sAddress = .Range("A" & rw & ":" & ReturnName(lCol) & rw).Address
'~~> Set Range
Set rng = .Range(sAddress)
End With
End Sub
'~~> Function to return Column letter from column number
Function ReturnName(ByVal num As Integer) As String
ReturnName = Split(Cells(, num).Address, "$")(1)
End Function
Followup From Comments
Sub Sample()
Dim ws As Worksheet
Dim lCol As Long, rw As Long
Dim rng As Range
'~~> Change this to the relevant worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
rw = 2 '<~~ Known row
'~~> Find the last column which has data in that row
lCol = .Cells(rw, .Columns.Count).End(xlToLeft).Column
'~~> Set Range
Set rng = .Range(.Cells(rw, 1), .Cells(rw, lCol))
Debug.Print rng.Address
End With
End Sub