Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2010, 03:16 PM
Registered User
 
Join Date: Jun 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default remove same number on same column on the PO

Hello friends,
I have an excel spreadsheet with multiple Purchase order numbers. Each PO has multi of the same numbers on the same column ( I ) . How do I remove the same number out and leave only one number per PO with deleting the rows. I just need to remove the same number from the PO. ex. each PO has five of the same number on column I , I need to find a way to remove four of the five of those numbers in Ms Excel 2007. A macro would be great. Thanks in advance -K
 
Old June 15th, 2010, 03:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hello..

So you start with any column, read the PO, then read the I column. Go to next row, if the Po is the same delete value on cell on I column. You repeat this process until the PO change. When it change you start the process on I column again. Any problem coding this?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old June 15th, 2010, 04:03 PM
Registered User
 
Join Date: Jun 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can you help me with the VB code? as PO# is on Column A and the same numbers on column I

Thanks in advance
 
Old June 15th, 2010, 04:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

I can't make it for, I can help you if you have any problem with it.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old June 15th, 2010, 10:17 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Can you check if the followng is of any help:

http://vbadud.blogspot.com/2008/07/r...eet-using.html

http://vbadud.blogspot.com/2007/08/d...excel-vba.html

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old June 15th, 2010, 11:39 PM
Registered User
 
Join Date: Jun 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Shasur. What I need is the code to go into each PO and delete the multiple of the same number on the same PO. Please see below. So it needs to delete the phone# column for the duplicate one. Hope you can help thanks all.

PO phone# to be like this >> PO phone#
---- -------- --- -------
222 555-1237 222 555-1237
222 555-1233 222 555-1233
222 555-1233 222

223 555-1233 223 555-1233
223 555-1234 223 555-1234
223 555-1233 223
 
Old June 17th, 2010, 03:31 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Try the following code:

Code:
Sub Remove_Dupe_Row_Data()
Dim iMax As Long            ' Long M
Dim oWS As Worksheet            ' Sheet
Dim oFnd As Range
Dim sText As String
Dim i1 As Long

Set oWS = ActiveSheet
iMax = oWS.Cells.SpecialCells(xlCellTypeLastCell).Row
For i1 = 2 To iMax
    sText = oWS.Cells(i1, 4).Value
    Set oFnd = oWS.Range(oWS.Cells(1, 4), oWS.Cells(i1 - 1, 4)).Find(sText)
    If Not oFnd Is Nothing Then
        oWS.Cells(i1, 4).Value = "" ' Set the Fourth Column Value as Blank
    End If
Next i1
    

End Sub
It works for Fourth column . It makes the duplicate cells as blank.

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
remove multiple set of numbers from column Wt2010 Excel VBA 8 January 22nd, 2010 09:17 PM
Remove non-number parts of string fixit XSLT 4 October 15th, 2009 12:59 PM
Remove Gridview Column at Runtime akshay144 ASP.NET 3.5 Basics 2 August 26th, 2009 04:24 PM
Remove Gridview Column at Runtime akshay144 ASP.NET 3.5 Basics 0 August 20th, 2009 09:58 AM
Remove JTable row and column in one event rpalanivelu J2EE 0 October 30th, 2003 08:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.