Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with a macro
I have a worksheet with 4 columns: Account Description in column 1, Account Number in column 2, Debits in 3 and credits in 4. I also have ranges named for Assets and Liabilities. For the Assets, I would like to build a macro that will search for values in column 4, and if there are any to multiply the amount by -1 and then move it to column 3. I also would like to build a macro that will search or values in in the Liabilities range that have an amount in column 3, and if so to multiply it by -1 and move it to column 4. Please help. Dale. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with a macro
Dale,
I assume that there will only be a value in column C or D. This is based upon that Dim cRows As Long Dim i As Long cRows = Cells(Rows.Count, "A").End(xlUp).Row For i = 1 To cRows If Not IsEmpty(Cells(i, "C").Value) Then Cells(i, "D").Value = -Cells(i, "C").Value Else Cells(i, "C").Value = -Cells(i, "D").Value End If Next -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) wrote in message ... I have a worksheet with 4 columns: Account Description in column 1, Account Number in column 2, Debits in 3 and credits in 4. I also have ranges named for Assets and Liabilities. For the Assets, I would like to build a macro that will search for values in column 4, and if there are any to multiply the amount by -1 and then move it to column 3. I also would like to build a macro that will search or values in in the Liabilities range that have an amount in column 3, and if so to multiply it by -1 and move it to column 4. Please help. Dale. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |