Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM


All times are GMT +1. The time now is 08:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"