ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying cells to another workbook if the contain spacific words (https://www.excelbanter.com/excel-programming/280446-copying-cells-another-workbook-if-contain-spacific-words.html)

prwells

copying cells to another workbook if the contain spacific words
 
need a macro

i want to copy cell from o awork sheet to a spacific work sheet
if one cell = a spacific word eg bars, maintinance, kings,reef
i want it to copy it to a sheet called that spacific work in a new
work book

i wrote the following macro

Sheets("order Sheet").Select
If Range("E3") = "1" Then
Range("a3:o3").Select
Selection.Copy
End If
If Range("e4") = "1" Then
Range("a3:o3").Select
Selection.Copy
End If
Application.Run "copyfromordersheetadmin"
end sub

Public Sub Copyfromordersheetadmin()
Windows("purchase orders.xls").Activate
ActiveWindow.WindowState = xlNormal
Sheets("Order Sheet").Select
Selection.Copy
' Sheets("Stock Record").Select
' Selection.SpecialCells(xlCellTypeLastCell).Select
' ActiveCell.Offset(1, -11).Select

gotolastcelladmin

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
'Selection.SpecialCells(xlCellTypeLastCell).Select
Range("a1").Select




End Sub
Public Sub gotolastcelladmin()

Windows("department orders.xls").Activate
ActiveWindow.WindowState = xlNormal
Sheets("admin").Select
ActiveSheet.Cells(1, 1).Select
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(tbl.Rows.Count, 0).Resize(tbl.Rows.Count - (tbl.Rows.Count -
1), tbl.Columns.Count - (tbl.Columns.Count - 1)).Select

End Sub

this worked and i wrote a macro for each of the words
and then created a macro that would run all of these macros
but it copied to to all sheets not just the sheet that i told it to
copy it to



------------------------------------------------
~~ 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 07:10 PM.

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