Hi all,
I am completely new here.
I have looked over the forum and I have found posts, that related to what I am looking for assistance with.
However I cannot get the solutions to work for me.
Question:
I have the below VBA code and it works a charm - It could probably be simpler, but it works for my need, so it is all good.
I do however meet an issue. When the user already have the "Trykktape NO" workbook open, the user is asked, if they want t reopen it.
I am looking for a piece of code that will:
- Open the workbook "Tykktape NO"
- If the workbook is already open, then activate it
- Then runs the rest of my code
I know this is probably the simplest thing, but I cannot figure this out for the life of me.
Can anyone assist with a piece of code, that I can simply copy into my own?
Thank you very much in advance.
Best Regards
Jonas
I am completely new here.
I have looked over the forum and I have found posts, that related to what I am looking for assistance with.
However I cannot get the solutions to work for me.
Question:
I have the below VBA code and it works a charm - It could probably be simpler, but it works for my need, so it is all good.
I do however meet an issue. When the user already have the "Trykktape NO" workbook open, the user is asked, if they want t reopen it.
I am looking for a piece of code that will:
- Open the workbook "Tykktape NO"
- If the workbook is already open, then activate it
- Then runs the rest of my code
I know this is probably the simplest thing, but I cannot figure this out for the life of me.
Can anyone assist with a piece of code, that I can simply copy into my own?
Thank you very much in advance.
Best Regards
Jonas
Code:
Sub CopyAndPasteData2()
Dim wbk As Workbook
'strFirstFile = "C:\Users\andejon\Desktop\New ordersheet.xlsm"
strSecondFile = "Q:\Operations\Customer Service\Order handling\Trykktape NO.xlsm"
Sheets("Calculations").Range("H3:L3").Copy
Set wbk = Workbooks.Open(strSecondFile)
With wbk.Sheets("Trykktape Norge")
Dim BlankRow As Long
BlankRow = Range("A65536").End(xlUp).Row + 1
Cells(BlankRow, 1).Select
ActiveCell.Value = Date
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = "New"
ActiveCell.Offset(0, 1).Select
ActiveCell.PasteSpecial xlPasteValues
ActiveCell.Offset(0, 5).Select
ActiveCell.Value = "Afventer proof"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = "Afventer LogoTape"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = "Sendt " & Date
ActiveCell.Offset(0, -7).Select
End With
Workbooks("Trykktape NO").Save
'Workbooks("Trycktape överblik - SE").Close
Workbooks("New ordersheet.xlsm").Activate
Application.Dialogs(xlDialogSendMail).Show Range("Calculations!E2"), Range("Calculations!E6")
End Sub