#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default Row - 1 in vba

I have a Name define Row B104:O104 as [Last], but I would like it to take 1
row before [Last]. something like - 1. so if [Last] is B104:O104 i want
B103:O103 to be the row selected.

code in VBA
Right now I have Range("B31:O31", [Last])

I wnat it to be Range("B31:O31", [Last]-1) or something.

I tried [Last].Row-1 but did not work. got an error when i ran it.

Thank You
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Row - 1 in vba

Range("B31:O31", Range("Last").Offset(-1, 0))
--
HTH...

Jim Thomlinson


"Damian" wrote:

I have a Name define Row B104:O104 as [Last], but I would like it to take 1
row before [Last]. something like - 1. so if [Last] is B104:O104 i want
B103:O103 to be the row selected.

code in VBA
Right now I have Range("B31:O31", [Last])

I wnat it to be Range("B31:O31", [Last]-1) or something.

I tried [Last].Row-1 but did not work. got an error when i ran it.

Thank You

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Row - 1 in vba

Range("B31:O31").Resize(Range("Last").Row-Range("B31:O31").row)

Range("B31:O31").Resize(Range("Last").Row-Range("B31:O31").row).Select

If this post helps click Yes
---------------
Jacob Skaria


"Damian" wrote:

I have a Name define Row B104:O104 as [Last], but I would like it to take 1
row before [Last]. something like - 1. so if [Last] is B104:O104 i want
B103:O103 to be the row selected.

code in VBA
Right now I have Range("B31:O31", [Last])

I wnat it to be Range("B31:O31", [Last]-1) or something.

I tried [Last].Row-1 but did not work. got an error when i ran it.

Thank You

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"