ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Row spec (https://www.excelbanter.com/excel-programming/432972-row-spec.html)

LiAD

Row spec
 
Hello again,

Another small simple question for someone that knows how.

How do i adapt this code in order to stop copying at row 109 maximum? So
its max copying range is 11 to 109 inclusive.

LastRow = Range("E" & Rows.Count).End(xlUp).Row
Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

Thanks
LiAD

Patrick Molloy[_2_]

Row spec
 
see below

"LiAD" wrote:

Hello again,

Another small simple question for someone that knows how.

How do i adapt this code in order to stop copying at row 109 maximum? So
its max copying range is 11 to 109 inclusive.

LastRow = Range("E" & Rows.Count).End(xlUp).Row

If LastRow109 then lastRow = 109

Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

Thanks
LiAD


Mauro Gamberini[_3_]

Row spec
 
Try

LastRow = Range("E" & Rows.Count).End(xlUp).Row
If LastRow 109 then
LastRow = 109
End If
Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

--
---------------------------
Mauro Gamberini
http://www.riolab.org/
http://blog.maurogsc.eu/
http://social.microsoft.com/Forums/i...ficeit/threads


"LiAD" ha scritto nel messaggio
...
Hello again,

Another small simple question for someone that knows how.

How do i adapt this code in order to stop copying at row 109 maximum? So
its max copying range is 11 to 109 inclusive.

LastRow = Range("E" & Rows.Count).End(xlUp).Row
Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

Thanks
LiAD




LiAD

Row spec
 
OK,

Thanks for this. It does stop it at row 109, which I thought would have
solved my problem, but it doesn't for some reason.

I have a table of values which are copy pasted from other sources using a
macro. I have only data in cells C10-O15, the rest until row 109 are empty,
no formulas either.

When i run this macro it is copying the formulas down in all cells from 11
to 109, even the ones with an empty E cell. Even if i hit delete in the E
cells that are empty before i run the macro it still doesnt work.

Do you know why this would be or how I would fix it?

Sub CopyFormulas()

Sheets("1").Select

lastRow = Range("E" & Rows.Count).End(xlUp).Row
If lastRow 109 Then lastRow = 109
Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & lastRow),
Type:=xlFillDefault

End Sub

Thanks
LiAD

"Patrick Molloy" wrote:

see below

"LiAD" wrote:

Hello again,

Another small simple question for someone that knows how.

How do i adapt this code in order to stop copying at row 109 maximum? So
its max copying range is 11 to 109 inclusive.

LastRow = Range("E" & Rows.Count).End(xlUp).Row

If LastRow109 then lastRow = 109

Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

Thanks
LiAD


LiAD

Row spec
 
Thanks.

Tried and works but I get the same issue as my reply to Patrick with the
copying formulas into rows where cell E is empty.

Thanks

"Mauro Gamberini" wrote:

Try

LastRow = Range("E" & Rows.Count).End(xlUp).Row
If LastRow 109 then
LastRow = 109
End If
Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

--
---------------------------
Mauro Gamberini
http://www.riolab.org/
http://blog.maurogsc.eu/
http://social.microsoft.com/Forums/i...ficeit/threads


"LiAD" ha scritto nel messaggio
...
Hello again,

Another small simple question for someone that knows how.

How do i adapt this code in order to stop copying at row 109 maximum? So
its max copying range is 11 to 109 inclusive.

LastRow = Range("E" & Rows.Count).End(xlUp).Row
Range("P11:AC11").AutoFill Destination:=Range("P11:AC" & LastRow),
Type:=xlFillDefault

Thanks
LiAD






All times are GMT +1. The time now is 08:40 AM.

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