Skip to content

Instantly share code, notes, and snippets.

@ulvham
Created September 25, 2015 02:58
Show Gist options
  • Save ulvham/9079dfb9ab913be7d709 to your computer and use it in GitHub Desktop.
Save ulvham/9079dfb9ab913be7d709 to your computer and use it in GitHub Desktop.
close_month
Private Sub CommandButton1_Click()
On Error Resume Next
path1 = [Q1]
path2 = [Q2]
shablon = [Q3]
Application.ScreenUpdating = False
For Each num In ActiveSheet.Range([Q4])
path_ = Replace(Replace(Replace(shablon, "№", num.Row), "@@@", path2), "###", path1)
ActiveSheet.Cells(num.Row, "P").FormulaLocal = "=" + path_
Next num
refresh_ path1 & path2
Application.ScreenUpdating = True
MsgBox "OK"
End Sub
Function refresh_(path)
On Error Resume Next
ActiveWorkbook.UpdateLink Name:=path, Type:=xlExcelLinks
End Function
Private Sub CommandButton2_Click()
refresh_ path1 & path2
MsgBox "OK"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment