Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Use Offset in formula

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Use Offset in formula

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Use Offset in formula

Try either

=TEXT(OFFSET(B1,0,1),"mm/dd")

or

=TEXT(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,1 ),"mm/dd")

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Mon, 15 Dec 2008 10:44:00 -0800, Alex
wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Use Offset in formula

This is perfect except that I need the address to be relative.

"Mike H" wrote:

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Use Offset in formula

Then use the optional arguments available to the Address property...

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address(0, 0) & ",
""mm/dd"")"

--
Rick (MVP - Excel)


"Alex" wrote in message
...
This is perfect except that I need the address to be relative.

"Mike H" wrote:

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is
the
cell to the right of the cell I'm writing the formula in. Am I at all
close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0,
columnOffset:=1),"mm/dd")"




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Use Offset in formula

Hi,

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address(0, 0) & ",
""mm/dd"")"

note the addition of (0,0 after the address

Mike

"Alex" wrote:

This is perfect except that I need the address to be relative.

"Mike H" wrote:

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Use Offset in formula

Sometimes, using the R1C1 reference style makes life easier:

selection.formulaR1C1 = "=text(rc[1],""mm/dd"")"

And remember that if your string includes double quotes ("), you have to double
them ("").





Alex wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Use Offset in formula

Great - thank you.

"Mike H" wrote:

Hi,

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address(0, 0) & ",
""mm/dd"")"

note the addition of (0,0 after the address

Mike

"Alex" wrote:

This is perfect except that I need the address to be relative.

"Mike H" wrote:

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Use Offset in formula

Glad I could help

"Alex" wrote:

Great - thank you.

"Mike H" wrote:

Hi,

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address(0, 0) & ",
""mm/dd"")"

note the addition of (0,0 after the address

Mike

"Alex" wrote:

This is perfect except that I need the address to be relative.

"Mike H" wrote:

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OFFSET Formula Kiley Excel Discussion (Misc queries) 5 March 31st 10 04:11 PM
1 OFFSET FORMULA, I'M NOT SURE WHAT DOES IT MEAN!!!!!! HERNAN Excel Discussion (Misc queries) 2 July 9th 07 07:41 PM
Offset formula jostlund Excel Discussion (Misc queries) 4 May 23rd 07 04:01 PM
Offset in Formula Joey Excel Discussion (Misc queries) 1 November 12th 06 01:23 AM
Offset Formula H.Schurch Excel Programming 1 July 13th 03 11:07 AM


All times are GMT +1. The time now is 05:45 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"