Runtime Generating Formula with VBA Code

B

bm

hello to anyone,

the following Formula works if I put it in any cell and fill the required
informations on the related cells

=WENN(A1="f";WENN(G1="SA";((D1-B1)*60+(E1-C1)-510);((D1-B1)*60+(E1-C1)-450))
;WENN(A1="s";((D1-B1)*60+(E1-C1)-540);WENN(A1="n";WENN(B1>D1;(((24+D1)-B1)*6
0+(E1-C1)-540);((D1-B1)*60+(E1-C1)-540));((D1-B1)*60+(E1-C1)-540))))

The point is that I want to generate this Formula with VBA during I create a
new Sheet.
That means I want to genreate it dynamically while opening a File.

thanx in advance
bameh1
 
B

Bernie Deitrick

bameh,

Simply turn on your macro recorder, select the cell, press F2, then press
enter. Your recorded macro will have the proper code to generate that
formula in a cell.

HTH,
Bernie
MS Excel MVP
 
B

bm

perfect

many thanx
bameh1

Bernie Deitrick said:
bameh,

Simply turn on your macro recorder, select the cell, press F2, then press
enter. Your recorded macro will have the proper code to generate that
formula in a cell.

HTH,
Bernie
MS Excel MVP


=WENN(A1="f";WENN(G1="SA";((D1-B1)*60+(E1-C1)-510);((D1-B1)*60+(E1-C1)-450))
;WENN(A1="s";((D1-B1)*60+(E1-C1)-540);WENN(A1="n";WENN(B1>D1;(((24+D1)-B1)*6 create
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top