Thread: Macro code
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Shu of AZ Shu of AZ is offline
external usenet poster
 
Posts: 130
Default Macro code

Thanks again, I figured out the definition of the variables

"excelent" wrote:

Sub findWB()
For Each wb In Workbooks
If Right(wb.Name, 3) = "csv" Then csvBook = wb.Name
Next
Workbooks(csvBook).Sheets(1).Cells.Copy ActiveWorkbook.ActiveSheet.Cells
End Sub


"Shu of AZ" skrev:

The first loaded workbook changes names daily and there may be many other
workbooks open. Only one will have the .csv extension

"excelent" wrote:

Copy from first loaded workbook (1) to active workbook

Sub xCopy()
Workbooks(1).Sheets(1).Cells.Copy ActiveWorkbook.ActiveSheet.Cells
End Sub


"Shu of AZ" skrev:

In the example below, I am trying to go from a worksheet BOOK1.xls to another
worksheet already open Tup071130_hr.csv and copy then go back to BOOK1.xls
and paste the contents.
The worksheet i want to go to will be named something different each day but
end with .csv and will have 12 preceeding characters. Since it changes daily
I need to use a wildcard for the window name. I can't get a wildcard of any
type to work. Can anyone tell me how it should be worded in the macro to see
the open and new worksheet when it is open each day? Thanks in advance.

Windows("????????????.csv").Activate
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book1").Activate
ActiveSheet.Paste