#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Macro

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro

set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Macro

Tom,

It's almost OK despite the fact that when I click on the button all the results in column M are #NAME?
However, if I click on the formula bar, the result appears...
Any idea?

Tks.


"Tom Ogilvy" escreveu na mensagem ...
set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Macro

Tools/Options/Calculations
are your calculation setting set to manual/Automatic?



"Gustavo Strabeli" wrote:

Tom,

It's almost OK despite the fact that when I click on the button all the results in column M are #NAME?
However, if I click on the formula bar, the result appears...
Any idea?

Tks.


"Tom Ogilvy" escreveu na mensagem ...
set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Macro

They're set as automatic.
It's strange because when I put the cursor in the formula bar, the result appears, but I have to do it cell by cell.


"steve_doc" escreveu na mensagem ...
Tools/Options/Calculations
are your calculation setting set to manual/Automatic?



"Gustavo Strabeli" wrote:

Tom,

It's almost OK despite the fact that when I click on the button all the results in column M are #NAME?
However, if I click on the formula bar, the result appears...
Any idea?

Tks.


"Tom Ogilvy" escreveu na mensagem ...
set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro

"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

should have the comma in 2,25 changed to a period 2.25

I don't know if that will help.

--
Regards,
Tom Ogilvy


"Gustavo Strabeli" wrote:

Tom,

It's almost OK despite the fact that when I click on the button all the results in column M are #NAME?
However, if I click on the formula bar, the result appears...
Any idea?

Tks.


"Tom Ogilvy" escreveu na mensagem ...
set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Macro

Tried it already, but without sucess...
By chance do you know what the cause would be?


"Tom Ogilvy" escreveu na mensagem ...
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

should have the comma in 2,25 changed to a period 2.25

I don't know if that will help.

--
Regards,
Tom Ogilvy


"Gustavo Strabeli" wrote:

Tom,

It's almost OK despite the fact that when I click on the button all the results in column M are #NAME?
However, if I click on the formula bar, the result appears...
Any idea?

Tks.


"Tom Ogilvy" escreveu na mensagem ...
set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Macro

Tom,
I made it!
My excel is in Portuguese and I was inserting the function "IF(OR...." in Portuguese, but as one last trial, I changed it to English and it worked!
Thanks a lot for your help.

Gustavo.

"Gustavo Strabeli" escreveu na mensagem ...
Tried it already, but without sucess...
By chance do you know what the cause would be?


"Tom Ogilvy" escreveu na mensagem ...
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

should have the comma in 2,25 changed to a period 2.25

I don't know if that will help.

--
Regards,
Tom Ogilvy


"Gustavo Strabeli" wrote:

Tom,

It's almost OK despite the fact that when I click on the button all the results in column M are #NAME?
However, if I click on the formula bar, the result appears...
Any idea?

Tks.


"Tom Ogilvy" escreveu na mensagem ...
set rng = Range("L13",Range("L13").End(xldown)).offset(0,1)
rng.formula =
"=IF(OR(L13=""40HC"",L13=""40RH""),K13*2,25,IF(LEF T(L13,2)=""40"",K13*2,K13))"

--
Regards,
Tom Ogilvy



"Gustavo Strabeli" wrote:

Hi there!

Can anyone please inform how I can built a macro to apply a formula to some cells?
In other words, I need a button to click on it and have below formula applied from cell M13 until the last data in the same column M.
Formula is: =IF(OR(L13="40HC";L13="40RH");K13*2,25;IF(LEFT(L13 ;2)="40";K13*2;K13))

Thanks a lot.
Gustavo.


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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


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