Runtime Generating Formula with VBA Code

  • Thread starter Thread starter bm
  • Start date Start date
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
 
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
 
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
 
Back
Top