ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can i find out the last row when I do autofill? (https://www.excelbanter.com/excel-discussion-misc-queries/202170-how-can-i-find-out-last-row-when-i-do-autofill.html)

Coolquicc

How can i find out the last row when I do autofill?
 
Hi there,

I am trying to do the autofill with Macro as follows:

Range("L1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").Select
Selection.AutoFill Destination:=Range("L1:L1173"), Type:=xlFillDefault
Range("L1:L1173").Select

One thing has just been bothering me for so long time, which is how I can
find out the last row and put in the macro instead of just a number like
"L1173" as above, because the last row is always changing every time.

Appreciate any help with it. Thank u.


FSt1

How can i find out the last row when I do autofill?
 
hi
Sub Coolquicc()
Dim n As Long
n = Cells(Rows.Count, "L").End(xlUp).Row
Range("L1").FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").AutoFill Destination:=Range("L1:L" & n), Type:=xlFillDefault
Range("L1:L" & n).Select
End Sub

regards
FSt1

"Coolquicc" wrote:

Hi there,

I am trying to do the autofill with Macro as follows:

Range("L1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").Select
Selection.AutoFill Destination:=Range("L1:L1173"), Type:=xlFillDefault
Range("L1:L1173").Select

One thing has just been bothering me for so long time, which is how I can
find out the last row and put in the macro instead of just a number like
"L1173" as above, because the last row is always changing every time.

Appreciate any help with it. Thank u.


Coolquicc

How can i find out the last row when I do autofill?
 
Thank you very much, it helped.

"FSt1" wrote:

hi
Sub Coolquicc()
Dim n As Long
n = Cells(Rows.Count, "L").End(xlUp).Row
Range("L1").FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").AutoFill Destination:=Range("L1:L" & n), Type:=xlFillDefault
Range("L1:L" & n).Select
End Sub

regards
FSt1

"Coolquicc" wrote:

Hi there,

I am trying to do the autofill with Macro as follows:

Range("L1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").Select
Selection.AutoFill Destination:=Range("L1:L1173"), Type:=xlFillDefault
Range("L1:L1173").Select

One thing has just been bothering me for so long time, which is how I can
find out the last row and put in the macro instead of just a number like
"L1173" as above, because the last row is always changing every time.

Appreciate any help with it. Thank u.


FSt1

How can i find out the last row when I do autofill?
 
glad to help
regards
FSt1

"Coolquicc" wrote:

Thank you very much, it helped.

"FSt1" wrote:

hi
Sub Coolquicc()
Dim n As Long
n = Cells(Rows.Count, "L").End(xlUp).Row
Range("L1").FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").AutoFill Destination:=Range("L1:L" & n), Type:=xlFillDefault
Range("L1:L" & n).Select
End Sub

regards
FSt1

"Coolquicc" wrote:

Hi there,

I am trying to do the autofill with Macro as follows:

Range("L1").Select
ActiveCell.FormulaR1C1 = "=RC[-3]+RC[-2]/60+RC[-1]/3600"
Range("L1").Select
Selection.AutoFill Destination:=Range("L1:L1173"), Type:=xlFillDefault
Range("L1:L1173").Select

One thing has just been bothering me for so long time, which is how I can
find out the last row and put in the macro instead of just a number like
"L1173" as above, because the last row is always changing every time.

Appreciate any help with it. Thank u.



All times are GMT +1. The time now is 04:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com