Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Formula in macro

Hello,

I am trying to write a quick macro to insert the content of a specific cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Formula in macro

ActiveCell.Formula = "=Index(Client_List, Client_Selection,1)"

this assumes Client_List and Client_Selection are defined names/ranges
(Insert=Name=Define)

--
Regards,
Tom Ogilvy


"Eric" wrote:

Hello,

I am trying to write a quick macro to insert the content of a specific cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Formula in macro

Tom,

This places the formula in the cell. What if I want the result of the
formula instead?

Thank you.

Eric.

"Tom Ogilvy" wrote in message
...
ActiveCell.Formula = "=Index(Client_List, Client_Selection,1)"

this assumes Client_List and Client_Selection are defined names/ranges
(Insert=Name=Define)

--
Regards,
Tom Ogilvy


"Eric" wrote:

Hello,

I am trying to write a quick macro to insert the content of a specific
cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Formula in macro

With ActiveCell
.Formula = "=Index(Client_List, Client_Selection,1)"
.Value = .Value
End With

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
ActiveCell.Formula = "=Index(Client_List, Client_Selection,1)"

this assumes Client_List and Client_Selection are defined names/ranges
(Insert=Name=Define)

--
Regards,
Tom Ogilvy


"Eric" wrote:

Hello,

I am trying to write a quick macro to insert the content of a specific

cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a

macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula in macro

Set Client_List = Range("A1") ' A1 contains something like 10
Set Client_Selection = Range("B1:B200")
ActiveCell.Value = Application.Index(Client_List, Client_Selection,1)

--
Regards,
Tom Ogilvy


"Eric" wrote in message
...
Tom,

This places the formula in the cell. What if I want the result of the
formula instead?

Thank you.

Eric.

"Tom Ogilvy" wrote in message
...
ActiveCell.Formula = "=Index(Client_List, Client_Selection,1)"

this assumes Client_List and Client_Selection are defined names/ranges
(Insert=Name=Define)

--
Regards,
Tom Ogilvy


"Eric" wrote:

Hello,

I am trying to write a quick macro to insert the content of a specific
cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a

macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Formula in macro

Thanks Tom.

"Tom Ogilvy" wrote in message
...
Set Client_List = Range("A1") ' A1 contains something like 10
Set Client_Selection = Range("B1:B200")
ActiveCell.Value = Application.Index(Client_List, Client_Selection,1)

--
Regards,
Tom Ogilvy


"Eric" wrote in message
...
Tom,

This places the formula in the cell. What if I want the result of the
formula instead?

Thank you.

Eric.

"Tom Ogilvy" wrote in message
...
ActiveCell.Formula = "=Index(Client_List, Client_Selection,1)"

this assumes Client_List and Client_Selection are defined names/ranges
(Insert=Name=Define)

--
Regards,
Tom Ogilvy


"Eric" wrote:

Hello,

I am trying to write a quick macro to insert the content of a specific
cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a

macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Formula in macro

Bob,

Thank you.


"Bob Phillips" wrote in message
...
With ActiveCell
.Formula = "=Index(Client_List, Client_Selection,1)"
.Value = .Value
End With

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
ActiveCell.Formula = "=Index(Client_List, Client_Selection,1)"

this assumes Client_List and Client_Selection are defined names/ranges
(Insert=Name=Define)

--
Regards,
Tom Ogilvy


"Eric" wrote:

Hello,

I am trying to write a quick macro to insert the content of a specific

cell
from a 1 column array.
I am not sure of the syntax when you use an existing function in a

macro,
which probably explain
why it does not work.
Here's the quick macro

Thank you.

Eric.




Sub Macro1()
'
' Macro1 Macro


ActiveCell.FormulaR1C1 = Index(Client_List, Client_Selection)
Range("K20").Select
End Sub







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
How to add a formula using a macro Lawribird Excel Worksheet Functions 1 July 31st 09 04:34 PM
Macro formula help El Bee Excel Worksheet Functions 5 October 20th 08 04:16 PM
Formula - Macro orquidea Excel Discussion (Misc queries) 7 December 7th 07 02:19 AM
Formula or Macro Help trishl Excel Discussion (Misc queries) 0 March 24th 06 04:53 PM
Do I need a formula or Macro? Sharen Excel Worksheet Functions 2 July 10th 05 05:27 PM


All times are GMT +1. The time now is 10:36 PM.

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

About Us

"It's about Microsoft Excel"