J
James Agostinho
Hello NG,
Can someone please help me with a dynamic last cell problem?
Everyday I have a list of distributors that I have to send pricing info to,
nationwide we have over 35,000 account.
However, if I sort my list by state it come out different everyday.
When I finish sending then pricing info I have to fill in a column with my
name
This column id always D and always starts at D2, D1 is "Contacted By"
I've tried using the macro recorder and it wants to put in actual cell
address, but that change every time.
Sub LastCell()
Dim FirstCell As Variant
Dim LastCell As Variant
Range("A2").Select
FirstCell = ActiveCell.Offset(0, 3).Address
Selection.End(xlDown).Select
LastCell = ActiveCell.Offset(0, 3).Address
ActiveWorkbook.Names.Add Name:="MyRange", RefersToR1C1:= _
"=ohio.xls!" & FirstCell & ":" & LastCell ' Problem is here
End Sub
What I would like to do is fill in column D, from cell "D2" to the last
cell in column with my name - James
Can anyone please help me?
TIA
James
Can someone please help me with a dynamic last cell problem?
Everyday I have a list of distributors that I have to send pricing info to,
nationwide we have over 35,000 account.
However, if I sort my list by state it come out different everyday.
When I finish sending then pricing info I have to fill in a column with my
name
This column id always D and always starts at D2, D1 is "Contacted By"
I've tried using the macro recorder and it wants to put in actual cell
address, but that change every time.
Sub LastCell()
Dim FirstCell As Variant
Dim LastCell As Variant
Range("A2").Select
FirstCell = ActiveCell.Offset(0, 3).Address
Selection.End(xlDown).Select
LastCell = ActiveCell.Offset(0, 3).Address
ActiveWorkbook.Names.Add Name:="MyRange", RefersToR1C1:= _
"=ohio.xls!" & FirstCell & ":" & LastCell ' Problem is here
End Sub
What I would like to do is fill in column D, from cell "D2" to the last
cell in column with my name - James
Can anyone please help me?
TIA
James