Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default filtering he data is not always correct

Hello,

This is the VBA of filtering a data and then copy it to another sheet. This
code I found from this very helful forum. My question if I filter it for M
Code only( coz the project code is M10-7-001 or E10-7-005 and so on) it show
all, not only M. Anyone can help me why?

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 5 And Target.Column = 4 Then
'calculate criteria cell in case calculation mode is manual
Sheets("data").Range("Criteria2").Calculate
Worksheets("data").Range("database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("data").Range("criteria2"), _
CopyToRange:=Range("B10:v10"), Unique:=False
End If
End Sub


Thanks very much

Frank
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default filtering he data is not always correct

Hi Frank,

The range "Criteria2" is where the filtering query information resides.
Within that range you should have the crieteria "M*" in the column.
That will return all records starting with M. Hope that works.

Aran Black

"Frank Situmorang" wrote:

Hello,

This is the VBA of filtering a data and then copy it to another sheet. This
code I found from this very helful forum. My question if I filter it for M
Code only( coz the project code is M10-7-001 or E10-7-005 and so on) it show
all, not only M. Anyone can help me why?

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 5 And Target.Column = 4 Then
'calculate criteria cell in case calculation mode is manual
Sheets("data").Range("Criteria2").Calculate
Worksheets("data").Range("database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("data").Range("criteria2"), _
CopyToRange:=Range("B10:v10"), Unique:=False
End If
End Sub


Thanks very much

Frank

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default filtering he data is not always correct

Yes..Aran, it works for my code starts with M, but actually there is a code
Only M, means that invoice was not yet split by Project Manager with the Code
number, so we want to remind them to split it, and we want to populate all
that invoices, but it doest not work if I put in cireteria2 the M.

Do you know why?

Frank


"Aran Black" wrote:

Hi Frank,

The range "Criteria2" is where the filtering query information resides.
Within that range you should have the crieteria "M*" in the column.
That will return all records starting with M. Hope that works.

Aran Black

"Frank Situmorang" wrote:

Hello,

This is the VBA of filtering a data and then copy it to another sheet. This
code I found from this very helful forum. My question if I filter it for M
Code only( coz the project code is M10-7-001 or E10-7-005 and so on) it show
all, not only M. Anyone can help me why?

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 5 And Target.Column = 4 Then
'calculate criteria cell in case calculation mode is manual
Sheets("data").Range("Criteria2").Calculate
Worksheets("data").Range("database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("data").Range("criteria2"), _
CopyToRange:=Range("B10:v10"), Unique:=False
End If
End Sub


Thanks very much

Frank

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
Filtering of data - autmatically based on data on other sheet uptonfamilywa Excel Discussion (Misc queries) 1 June 20th 09 12:46 AM
Comparing Data (Im not sure if that is the correct tern) AngelaD Excel Discussion (Misc queries) 1 January 16th 07 04:55 PM
Autopaste data based on correct MO. ineedhelp2[_6_] Excel Programming 0 August 31st 05 03:13 PM
Pivot table converts data to a 1,2,3 how do I get data to correct mjohnston1327 Excel Discussion (Misc queries) 1 August 17th 05 10:28 PM
joining to worksheets or filtering not sure of correct terminology MG New Users to Excel 3 January 23rd 05 10:11 PM


All times are GMT +1. The time now is 09:01 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"