ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button macro from filtered data (https://www.excelbanter.com/excel-programming/282328-button-macro-filtered-data.html)

alan_bourne[_5_]

Button macro from filtered data
 

ok heres the jist of it.....
i have sheet 1 which contains all of the data on my spreadsheet. The
data here is auto filtered. after filtering the feilds to get the
product i want i then want to add it to new page under previous orders
like a shoping kart on page 2 using a macro and button. under i have
included some screenshots below to show u what i mean but this is
really puzzeling me big time plus i'm not to used to excel. any help
would be much apreciated

thanks alan bourne

heres the link to what i need doing ......
[image: http://www.you-are-a-huge-nerd.com/p...sig/excel.jpg]


+----------------------------------------------------------------+
| Attachment filename: caraudio.xls |
|Download attachment: http://www.excelforum.com/attachment.php?postid=356605|
+----------------------------------------------------------------+

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


alan_bourne[_6_]

Button macro from filtered data
 

please hel

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Tom Ogilvy

Button macro from filtered data
 
Sub invoicenum()
Worksheets("Sheet1").Range("A16").AutoFilter _
Field:=1, _
Criteria1:=Range("Sheet2!c8").Value
Worksheets("Sheet1").AutoFilter.Range.Copy _
Destination:=Worksheets("Sheet2").Range("B9")
End Sub

Adjust to fit your actual layout.

--
regards,
Tom Ogilvy



"alan_bourne" wrote in message
...

ok heres the jist of it.....
i have sheet 1 which contains all of the data on my spreadsheet. The
data here is auto filtered. after filtering the feilds to get the
product i want i then want to add it to new page under previous orders
like a shoping kart on page 2 using a macro and button. under i have
included some screenshots below to show u what i mean but this is
really puzzeling me big time plus i'm not to used to excel. any help
would be much apreciated

thanks alan bourne

heres the link to what i need doing ......
[image: http://www.you-are-a-huge-nerd.com/p...sig/excel.jpg]


+----------------------------------------------------------------+
| Attachment filename: caraudio.xls |
|Download attachment:

http://www.excelforum.com/attachment.php?postid=356605|
+----------------------------------------------------------------+

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




alan_bourne[_7_]

Button macro from filtered data
 

but will this not just paste the details over each other each time?

in the screenshot sheet 2 are only examples of what i want it to look
like...
e.g 5 sony jhdgfjh 1 £199.99
5 panasonic 789-op 1 £199.67

i need the sony part to come from the sheet 1 page after the filter has
been done and i can see the product
so it may be in row 78 but will be displayed at the top of the sheet
becasue the others are hidden. i then need a button to imput this data
under the last piece of data in the b coloumn on sheet 2
the invoice number eg 5 is repeated because that is the invoice number
and the person buying those products may buy 3 or 4 items so the
number 5 is needed for the next 5 products

please help also thanks for your time


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


alan_bourne[_8_]

Button macro from filtered data
 

for get the fact theres a unique id filter that does not need to be
there it will be gone


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Tom Ogilvy

Button macro from filtered data
 
You only want to copy 1 cell and it is visible?

set rng = Worksheets("Sheet1").Autofilter.Range.Columns(2)
set rng.offset(1,0).Resize(rng.rows.count-1,1)
On Error Resume Next
set rng = rng.specialcells(xlvisible)
On Error goto 0
if not rng is nothing then
worksheets("Sheet2").Cells(rows.count,2).End(xlup) (2).Value = _
rng(1).Value
End if

--
Regards,
Tom Ogilvy


"alan_bourne" wrote in message
...

for get the fact theres a unique id filter that does not need to be
there it will be gone


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




alan_bourne[_10_]

Button macro from filtered data
 

mate you are being verytolerable thanks this is totaly confusing me

if you could just take a last look at this file i have underlined what
is needed and is very clear now trust me :D thank you for your help
once again

alan bourne


+----------------------------------------------------------------+
| Attachment filename: caraudio.xls |
|Download attachment: http://www.excelforum.com/attachment.php?postid=356754|
+----------------------------------------------------------------+

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


alan_bourne[_11_]

Button macro from filtered data
 

???????? any luc

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Tom Ogilvy

Button macro from filtered data
 
Sub Copydata()
Dim rng As Range

Set rng = Worksheets("Sheet1").AutoFilter.Range.Columns(3)
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1, 1)
On Error Resume Next
Set rng = rng.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng Is Nothing Then
Worksheets("Sheet2").Cells(Rows.Count, 2).End(xlUp)(2).Value = _
rng(1).Value
End If

End Sub

--
Regards,
Tom Ogilvy

"alan_bourne" wrote in message
...

???????? any luck


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




alan_bourne[_12_]

Button macro from filtered data
 

thanks alot mate it works cheers agai

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com



All times are GMT +1. The time now is 03:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com