ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open as template only (https://www.excelbanter.com/excel-programming/312616-open-template-only.html)

gavmer[_89_]

Open as template only
 

Hi,

Can someone advise as to how i write this code so that the user for
only opens if the file is a template?

Cheers!!

Private Sub machine_change()
Dim myVal As String
Dim fRng As Range
Dim tRng As Range
Set fRng = Nothing
Set tRng = Worksheets("inclusions").Range("h1")
Select Case machine.Text
Case Is = "MAN Roland R202"
Set fRng = Worksheets("pricing").Range("e1")
Case Is = "MAN Roland R204"
Set fRng = Worksheets("pricing").Range("f1")
Case Is = "MAN Roland R205"
Set fRng = Worksheets("pricing").Range("g1")
Case Is = "Clear"
Set fRng = Worksheets("pricing").Range("h1")
Case Else
End Select
If fRng Is Nothing Then
Else
tmp = MsgBox("Please note, you are selecting final machin
configuration and pricing!", vbOK)
fRng.EntireColumn.Copy _
Destination:=tRng
End If
End Sub

Private Sub UserForm_Initialize()
machine.AddItem ("MAN Roland R202")
machine.AddItem ("MAN Roland R204")
machine.AddItem ("MAN Roland R205")
End Su

--
gavme
-----------------------------------------------------------------------
gavmer's Profile: http://www.excelforum.com/member.php...nfo&userid=666
View this thread: http://www.excelforum.com/showthread.php?threadid=26674



All times are GMT +1. The time now is 04:29 PM.

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