Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Manipulate filtered data

I have a shortage report generated daily by the company server. It has
PartNo (Col A), Owner (Col B), Comments (Col C), Qty (Col D). Part numbers
will only appear in this file if qty falls below certain value.

I already have a macro that can filter the daily shortage report by owner
(which is my name). Based on the filtered list (all part numbers that belong
to me), I will update the comments column.

Now I created a master file with all the part numbers that I need to take
care of. It has 2 columns: MyPartNo (col A) and Comments (col B).

I also created a macro that can match the PartNo in shortage report to
MyPartNo in my master file, copy the comments I enter earlier in shortage
report and then paste it to Comments column (Col B) in my master file. But
this macro still check all PartNo in the shortage file despite it's filtered.

How can I write the macro in such a way that it only match/look for the
PartNo based on the filtered list, but not every single part number in the
whole shortage report? This will reduce a lot of macro processing time.

choo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Manipulate filtered data

You would probably have to use the SpecialCells(xlCellTypeVisible) method to
skip the hidden cells created by the filter.



"choo" wrote in message
...
I have a shortage report generated daily by the company server. It has
PartNo (Col A), Owner (Col B), Comments (Col C), Qty (Col D). Part
numbers
will only appear in this file if qty falls below certain value.

I already have a macro that can filter the daily shortage report by owner
(which is my name). Based on the filtered list (all part numbers that
belong
to me), I will update the comments column.

Now I created a master file with all the part numbers that I need to take
care of. It has 2 columns: MyPartNo (col A) and Comments (col B).

I also created a macro that can match the PartNo in shortage report to
MyPartNo in my master file, copy the comments I enter earlier in shortage
report and then paste it to Comments column (Col B) in my master file.
But
this macro still check all PartNo in the shortage file despite it's
filtered.

How can I write the macro in such a way that it only match/look for the
PartNo based on the filtered list, but not every single part number in the
whole shortage report? This will reduce a lot of macro processing time.

choo



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Manipulate filtered data

Hi,
Based on the code below, how do I modify it to use xlCellTypeVisible like
you suggested?

NRowsComments = shtComments.Cells(1, 1).SpecialCells(xlLastCell).Row

shtSR.Activate
irow = 2
NRowsSR = Cells(1, 1).SpecialCells(xlLastCell).Row
For irow = irow To NRowsSR
PartNo = Trim(Cells(irow, 1).Value)
irow2 = 2
Fnd = False
While Not Fnd And irow2 <= NRowsComments
If Trim(shtComments.Cells(irow2, 1)) = PartNo Then
Fnd = True
If Cells(irow, 3) < "" Then
msgbox "copy and paste"
End If
Else
irow2 = irow2 + 1
End If
Wend
Next




"JLGWhiz" wrote:

You would probably have to use the SpecialCells(xlCellTypeVisible) method to
skip the hidden cells created by the filter.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Manipulate filtered data

I am not sure this will fly as part of your procedure, but it should give
you an idea of how to use the special cells. It looked to me like you were
only testing column A data, so I limited the range to check to only cells in
column A. In the For Each line, the range is restricted to only visible
cells so that the hidden cells will be ignored although the line above
includes them as part of the range.

Dim Nrng As Range
NRowsSR = Cells(1, 1).SpecialCells(xlLastCell).Row
Set Nrng = Range("A" & irow & ":A" & nRowsSR)
For Each c In Nrng.Cells.SpecialCells(xlCellTupeVisible)
PartNo = Trim(Cells(c.Row, 1).Value)
irow2 = 2
Fnd = False
While Not Fnd And irwo2 <=NRowsComments
If Trim(c.Value) = PartNo Then
Fnd = True
If Cells(c.Row, 3) < "" Then
MsgBox "Copy and Paste"
End If
Else
irow2 = c.Row + 1
End If
Wend
Next





"choo" wrote in message
...
Hi,
Based on the code below, how do I modify it to use xlCellTypeVisible like
you suggested?

NRowsComments = shtComments.Cells(1,
1).SpecialCells(xlLastCell).Row

shtSR.Activate
irow = 2
NRowsSR = Cells(1, 1).SpecialCells(xlLastCell).Row
For irow = irow To NRowsSR
PartNo = Trim(Cells(irow, 1).Value)
irow2 = 2
Fnd = False
While Not Fnd And irow2 <= NRowsComments
If Trim(shtComments.Cells(irow2, 1)) = PartNo Then
Fnd = True
If Cells(irow, 3) < "" Then
msgbox "copy and paste"
End If
Else
irow2 = irow2 + 1
End If
Wend
Next




"JLGWhiz" wrote:

You would probably have to use the SpecialCells(xlCellTypeVisible) method
to
skip the hidden cells created by the filter.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Manipulate filtered data

Your example works! Thank you.

Since I'm trying to learn about this "range" example, would you be able to
show me how should the code looks like if the data in destination file is
filtered instead of the source file?



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
Return filtered values into report worksheet based on filtered valueon the data worksheet dicko1 Excel Worksheet Functions 1 April 21st 09 12:27 AM
How do I manipulate data pulled from within an excel calendar? wkalmbach Excel Discussion (Misc queries) 1 August 21st 07 03:46 PM
Copy a table from a web site, then manipulate the data? Confused Rookie Excel Worksheet Functions 1 October 24th 06 12:19 AM
manipulate data sjl Excel Worksheet Functions 1 May 3rd 06 01:55 PM
How do I manipulate/sort data from a drop-down Excel list? [email protected] Excel Discussion (Misc queries) 0 February 15th 06 06:11 PM


All times are GMT +1. The time now is 05:35 PM.

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"