Formulas in a added worksheet VBA

M

Malcolm

Hi

I have had some excellent help in gettin a new worksheet
to be added pulling data from an Active Worksheet and
formatting it into individual statements using a macro.

The new worksheet added has 290 names and addresses, with
each name and address having a space of 25 lines between
the next name and address.

What I need to be able to do now is to haver certain Cells
to have a formula added into the added worksheet.

For example, each cell in column "L" and in row 15 of each
statement might have the formula F23/3.054. There are
quite a few cells in each statement that need this so I
would like to automate it as the worksheet is added.

Is this possible.

Many thanks

Malcolm
 
P

Peter Atherton

Hello Malcolm

I'm not sure if this is what you want.

Sub CalcIf()
For Each c In Selection
If IsEmpty(c.Offset(0, -6)) Then
c = c
ElseIf IsNumeric(c.Offset(0, -6)) Then
c.Value = c.Offset(0, -6) / 3.054
End If
Next c

End Sub

Select the range column L and run the macro. It leaves
blank cells in column L if column F is empty and performs
a calculation if there is a number.

Of course it assumes that you always want to use the same
divisor. Let me know if you want something more flexible.

Regards
Peter
 

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