Copy
Hi!
When my workbook (VT - it includes only one sheet)) is opened (it's in a network), this will happend: ReportNumber = ActiveSheet.Range("e5").Value ReportNumber = ActiveSheet.Range("e5").Value + 1 ActiveSheet.Range("e5").Value = ReportNumber FileSaveName = ActiveWorkbook.Path FileSaveNameEnd = FileSaveName & "\Arkiv\" varName = ActiveSheet.Name varDir = FileSaveNameEnd varYear = Format(Date, "yy") varNr = ReportNumber On Error GoTo ErrorHandler: ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear **After the workbook is opened a macro open another workbook called Statistikk (the user should not see this) Fileopen = ActiveWorkbook.Path Fileopenend = Fileopen & "\Arkiv\" & "Statistikk" Workbooks.Open "FileSaveName & FileSaveNameEnd & Statistikk" **and here is my problem, i want the information that is put into cell e5 also should be put into a specific cell into the new workbook (Statstikk) Sheet (Ark1) *****Here is my problem FirstCol = Workbooks(Statistikk).Worksheets(Ark1).Range_("Rep ort_Number").Column FirstRow = ReportNumber Cells(FirstRow, FirstCol).Value = ReportNumber I would appreciate all help! |
Copy
At top of general module, before any Sub(), put:
Public ReportNumber As Long This allows the variable to be passed to all procedures in the workbook In second macro that opens Statstikk, once it is open: Workbooks(Statistikk).Worksheets(Ark1).Range("A1") .Value = ReportNumber Mike F "Michael" wrote in message ... Hi! When my workbook (VT - it includes only one sheet)) is opened (it's in a network), this will happend: ReportNumber = ActiveSheet.Range("e5").Value ReportNumber = ActiveSheet.Range("e5").Value + 1 ActiveSheet.Range("e5").Value = ReportNumber FileSaveName = ActiveWorkbook.Path FileSaveNameEnd = FileSaveName & "\Arkiv\" varName = ActiveSheet.Name varDir = FileSaveNameEnd varYear = Format(Date, "yy") varNr = ReportNumber On Error GoTo ErrorHandler: ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear **After the workbook is opened a macro open another workbook called Statistikk (the user should not see this) Fileopen = ActiveWorkbook.Path Fileopenend = Fileopen & "\Arkiv\" & "Statistikk" Workbooks.Open "FileSaveName & FileSaveNameEnd & Statistikk" **and here is my problem, i want the information that is put into cell e5 also should be put into a specific cell into the new workbook (Statstikk) Sheet (Ark1) *****Here is my problem FirstCol = Workbooks(Statistikk).Worksheets(Ark1).Range_("Rep ort_Number").Column FirstRow = ReportNumber Cells(FirstRow, FirstCol).Value = ReportNumber I would appreciate all help! |
All times are GMT +1. The time now is 07:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com