Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Complete newb, I know!


Hello everyone, my problem is a very simple one.. probably easy for al
you programmers

I have a similar table in a spreadsheet like so:
Ordered........Shipped
50......................30
20......................20
10.......................5
20......................10

How would I take the difference of the two columns and have the valu
put in the first column, then have the value in the 'Shipped' colum
deleted. If the two values are identical to begin with, they would bot
be deleted.

For example in the first two rows:

Ordered........Shipped
50......................30
20......................20

Becomes...

Ordered........Shipped
20......................
......................

Thanks for any contributions!

--
grahamhurlbur
-----------------------------------------------------------------------
grahamhurlburt's Profile: http://www.excelforum.com/member.php...fo&userid=2987
View this thread: http://www.excelforum.com/showthread.php?threadid=49582

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Complete newb, I know!

Graham,

You could try this, which will work as long as you have the shipped values in column B and don't
have any blanks:

Sub GrahamSubtract()
With Columns("B:B").SpecialCells(xlCellTypeConstants, 1)
.Copy
.Offset(0, -1).Resize(, 2).PasteSpecial _
Paste:=xlPasteValues, Operation:=xlSubtract
End With
End Sub

Though this will leave 0s and not blanks.

If you do have blanks and/or want blanks, then use

Sub GrahamSubtract2()
Dim myCell As Range
For Each myCell In Range("B:B").SpecialCells(xlCellTypeConstants, 1)
myCell(1, 0).Value = myCell(1, 0).Value - myCell.Value
If myCell(1, 0).Value = 0 Then myCell(1, 0).ClearContents
myCell.ClearContents
Next myCell
End Sub


HTH,
Bernie
MS Excel MVP


"grahamhurlburt" <grahamhurlburt.20ibmm_1135365002.5284@excelforu m-nospam.com wrote in message
news:grahamhurlburt.20ibmm_1135365002.5284@excelfo rum-nospam.com...

Hello everyone, my problem is a very simple one.. probably easy for all
you programmers

I have a similar table in a spreadsheet like so:
Ordered........Shipped
50......................30
20......................20
10.......................5
20......................10

How would I take the difference of the two columns and have the value
put in the first column, then have the value in the 'Shipped' column
deleted. If the two values are identical to begin with, they would both
be deleted.

For example in the first two rows:

Ordered........Shipped
50......................30
20......................20

Becomes...

Ordered........Shipped
20......................
.....................

Thanks for any contributions!!


--
grahamhurlburt
------------------------------------------------------------------------
grahamhurlburt's Profile: http://www.excelforum.com/member.php...o&userid=29878
View this thread: http://www.excelforum.com/showthread...hreadid=495825



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Complete newb, I know!


Thank you Bernie!! It worked perfectly

Sigh, I'm so helpless when it comes to macros..haha


--
grahamhurlburt
------------------------------------------------------------------------
grahamhurlburt's Profile: http://www.excelforum.com/member.php...o&userid=29878
View this thread: http://www.excelforum.com/showthread...hreadid=495825

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
Here is a simple formula request from a newb Darryl Excel Worksheet Functions 5 July 27th 06 08:51 PM
Help a newb.... gibson00 Excel Discussion (Misc queries) 6 July 11th 06 02:21 PM
i know this has to be so easy -newb chris_ Excel Discussion (Misc queries) 6 July 11th 05 09:57 PM
VBA newb needing help with an IF duster Excel Programming 4 June 27th 04 10:28 PM
VBA newb needing help with an IF duster Excel Programming 0 June 27th 04 10:18 PM


All times are GMT +1. The time now is 01:19 AM.

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

About Us

"It's about Microsoft Excel"