Excel Macros>Functions

Closed
Chris - Oct 26, 2011 at 06:13 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Oct 27, 2011 at 10:45 PM
Hello,
I have a function that I need some help with to save a mass amount of time. I have a report tab named "total" which I would like to keep, but also write a function that will allow another sheet to pull an entire row off this spreadsheet given it meets the criteria in one cell.

In short, if one new sheet could pull any info with A22 and the other with A35 in column C and repeat this continually as new rows are added and deleted. Somebody please save me hours!

Thanks,

Average Excel User


Related:

2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Oct 26, 2011 at 09:35 PM
"if one new sheet could pull any info with A22 and the other with A35 in column C"

what is connection with A22 and A35
what is meant by "A35 in column C". A35 is intersection of row 35 and column A. do you mean intersection of row 35 and column C.

preferably post a small extract of your data
0
Im sorry, I see how that could be confusing.

"A22" and "A35" are company #s (not a cell reference), so my 200+ rows of data would contain either an "A22" or "A35" in column C.
0
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Oct 27, 2011 at 10:45 PM
suppose sample data in sheet 1 is like this. the required company% A22 and A35 are colored yellow only for identification purposes. you can remove the color

HDNG1 HDNG2 HDNG3 HDNG4
39 36 B1 81
25 20 B2 39
2 32 B3 38
8 61 A22 43
19 45 B4 85
49 16 B5 88
99 53 A35 2
71 38 B7 3
75 44 B8 33

now try this macro and see sheet2

Sub test()
Dim r As Range, filt As Range
Worksheets("sheet2").Cells.Clear
With Worksheets("sheet1")
Set r = .Range("A1").CurrentRegion
r.AutoFilter Range("C1").Column, "A22", xlOr, "A35"
Set filt = r.Offset(1, 0).Resize(Rows.Count - 1, Columns.Count).SpecialCells(xlCellTypeVisible)
filt.Copy
With Worksheets("sheet2")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
End With
r.AutoFilter
End With
End Sub


every time you add data run the macro . if you want automatic then do an event code under workbook_close event and under this type the name of the macro. so every time you close the file the macro will be run
0