-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule3.bas
More file actions
executable file
·44 lines (33 loc) · 1.05 KB
/
Module3.bas
File metadata and controls
executable file
·44 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Attribute VB_Name = "Module3"
Option Explicit
Sub FilePicker()
Dim wsName As String: wsName = "Main"
' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
ThisWorkbook.Worksheets(wsName).Range("L5").Value = .SelectedItems(1)
End If
End With
End Sub
Sub Reset()
Dim i As Long
Dim lastRow As Integer
Dim wsName As String: wsName = "Main"
' Clearing previous connections
With ThisWorkbook
For i = .Connections.Count To 1 Step -1
.Connections(i).Delete
Next i
End With
' Clearing previous content
With ThisWorkbook.Worksheets(wsName)
lastRow = .Cells(.Rows.Count, "A").End(xlUp).row
If lastRow <> 7 Then
.Range("A8:P" & lastRow).ClearContents
.Range("A8:P" & lastRow).Interior.ColorIndex = 0
End If
End With
'ThisWorkbook.Worksheets(1).Range("Q8").Interior.Color = RGB(240, 155, 68)
End Sub