Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA adjustment for beginner

Good evening All
I am hoping that someone will be able to help with this.
I have some small VBA code (shown below), which applies to the following example of a data set:

Worksheet "Invoice Record"
A B C
1 Header Header Header
2 M100 152.34 03
3 M101 100.02 NP
4 M100 250.65 02
5 M100 565.52 01
6 M102 745.87 NP
7 M101 985.65 03

Column A is Formatted Text, B Number, C Text. (Though columns A & C are flexible to other formats)

The code describes:- from column A copy unique values only to another location (another Worksheet ("General Report") in this case)
This works well, however I would really like the code to look at only the cells in column A that do not have NP as it's corresponding entry in Column C.
ie to ignore rows with NP in column C

I do hope that this is an easy fix, I am a novice at VBA but am learning! (Especially with help from this group)
Here Is the Code:

Sub ECRGeneralReportPopulation()
' Automates The General Report Population

Application.Interactive = False
Dim myRng As Range
Sheets("General Report").Range("A:A").ClearContents
With Sheets("Invoice Record")
Set myRng = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp))
End With
myRng.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("General Report").Range("A2"), Unique:=True
Application.Interactive = True
End Sub

I hope someone can help
Cheers
Mathew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default VBA adjustment for beginner

Matthew,

Tricky one. I think you would be better to use AUtofilter, but one key question. If you only want to select where C =NP, will the unique test apply to all rows, or only rows with NP in C. As an example, if A1=M100 and A2=M100, C1 = "NP" and C2="O1", is M100 unique or not?

--

HTH

Bob Phillips

"mpb1" wrote in message ...
Good evening All
I am hoping that someone will be able to help with this.
I have some small VBA code (shown below), which applies to the following example of a data set:

Worksheet "Invoice Record"
A B C
1 Header Header Header
2 M100 152.34 03
3 M101 100.02 NP
4 M100 250.65 02
5 M100 565.52 01
6 M102 745.87 NP
7 M101 985.65 03

Column A is Formatted Text, B Number, C Text. (Though columns A & C are flexible to other formats)

The code describes:- from column A copy unique values only to another location (another Worksheet ("General Report") in this case)
This works well, however I would really like the code to look at only the cells in column A that do not have NP as it's corresponding entry in Column C.
ie to ignore rows with NP in column C

I do hope that this is an easy fix, I am a novice at VBA but am learning! (Especially with help from this group)
Here Is the Code:

Sub ECRGeneralReportPopulation()
' Automates The General Report Population

Application.Interactive = False
Dim myRng As Range
Sheets("General Report").Range("A:A").ClearContents
With Sheets("Invoice Record")
Set myRng = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp))
End With
myRng.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("General Report").Range("A2"), Unique:=True
Application.Interactive = True
End Sub

I hope someone can help
Cheers
Mathew

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default VBA adjustment for beginner

See one more guess at your post in .misc.

mpb1 wrote:

Good evening All
I am hoping that someone will be able to help with this.
I have some small VBA code (shown below), which applies to the following
example of a data set:

Worksheet "Invoice Record"
A B C
1 Header Header Header
2 M100 152.34 03
3 M101 100.02 NP
4 M100 250.65 02
5 M100 565.52 01
6 M102 745.87 NP
7 M101 985.65 03

Column A is Formatted Text, B Number, C Text. (Though columns A & C are
flexible to other formats)

The code describes:- from column A copy unique values only to another
location (another Worksheet ("General Report") in this case)
This works well, however I would really like the code to look at only the
cells in column A that do not have NP as it's corresponding entry in Column C.
ie to ignore rows with NP in column C

I do hope that this is an easy fix, I am a novice at VBA but am learning!
(Especially with help from this group)
Here Is the Code:

Sub ECRGeneralReportPopulation()
' Automates The General Report Population

Application.Interactive = False
Dim myRng As Range
Sheets("General Report").Range("A:A").ClearContents
With Sheets("Invoice Record")
Set myRng = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp))
End With
myRng.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("General Report").Range("A2"), Unique:=True
Application.Interactive = True
End Sub

I hope someone can help
Cheers
Mathew


--

Dave Peterson

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
Sumproduct Adjustment Ellen G Excel Discussion (Misc queries) 4 November 29th 07 09:14 PM
Formula Adjustment? DaveAsh Excel Worksheet Functions 2 November 14th 07 03:24 PM
formula adjustment Candace Excel Worksheet Functions 2 November 3rd 07 10:02 PM
Formula Adjustment - Help Josh O. Excel Worksheet Functions 1 January 24th 07 02:58 PM
automatic adjustment daidipya Excel Discussion (Misc queries) 1 June 8th 06 02:46 PM


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

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"