Entering an IF formula into an adjacent cell with VBA

angelo328

New Member
Joined
Sep 21, 2010
Messages
9
Dear all
It's been a long time since I sought help from your goodselves and I have forgotten so much that even this seemingly easy task is alluding me. I have scoured the boards to see if I can canabalise code for my purpose but with little success. So here goes - please go easy on me and thanks in advance for your help.

It's that time of the year that I am trying to balance my bank statement. The problem is that my bank lumps the credit and debit amounts into one column. What I am trying to do with VBA is to seperate the amounts into seperate adjacent columns using an IF formula. So far I have the relevant formula for credit =IF($F1<0,$F1,"") and for debit =IF($F1>=0,$F1,"").

Many thanks in advance and a happy new year to all.


Angelo
PS I propose to use this code each month with other code that will seperate transaction codes e.g. DD, CHQ etc
 
Last edited:

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
How about
Code:
Sub angelo328()
   With Range("G1", Range("F" & Rows.Count).End(xlUp).Offset(, 2))
      .Formula = Array("=IF($F1<0,$F1,"""")", "=IF($F1>0,$F1,"""")")
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feednack
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top