![]() |
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! |
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! |
All times are GMT +1. The time now is 03:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com