Quick Documentation

This article contains a quick way to document stuff. I don't feel like explaining it today. The first CommanButton1_Click executes the ok subprocedure in the Module 1. I needed to put it in the Module so the scope of the button on the worksheet wouldn't limit me from changing the second workbook with the variable data.

Code for Documentation:

Private Sub CommandButton1_Click()
Call ok
End Sub

Sub ok()

Dim Value1 As String
Dim Value2 As String
Dim Value3 As String
Dim numberholder As Double
Dim i As Integer

Dim strArra(4) As String
Dim strArray(4) As String
Dim StrMsg As String

line45:
numberholder = InputBox("What row has the data that you want to document?")
Value1 = Range("A" & numberholder).Value
Value2 = Range("B" & numberholder).Value
Value3 = Range("C" & numberholder).Value



strArray(1) = Value1
strArray(2) = Value2
strArray(3) = Value3

strArra(1) = "Bank"
strArra(2) = "Stock"
strArra(3) = "Money"



StrMsg = "Do you want this selection, Yes or No?" & vbCr & vbCr
For i = 1 To UBound(strArray) - 1
    StrMsg = StrMsg & i & "-" & vbTab & strArra(i) & ":" & vbTab & strArray(i) & vbCr
Next i

answer = MsgBox(StrMsg, vbYesNo + vbInformation, "Click Yes to Accept this Selection or No to Select a new Row:")

If answer = 6 Then
    Else
GoTo line45:
End If

Range("AZ1").Value = Value1
Range("AZ2").Value = Value2
Range("AZ3").Value = Value3
Range("AZ4").Value = numberholder

Workbooks.Open Filename:=("C:\Users\18622\OneDrive\Desktop\Document PDF\Blank Document.xlsm")

Workbooks("Blank Document.xlsm").Activate

Range("AZ1").Value = Value1
Range("AZ2").Value = Value2
Range("AZ3").Value = Value3
Range("AZ4").Value = numberholder



End Sub

Code for Blank Document:

Private Sub CommandButton1_Click()

StrMsg = "Do you want to view/document image #1 or #2?" & vbCr & vbCr

answer = MsgBox(StrMsg, vbYesNo + vbInformation, "Click Yes for Image 1 or No for Image 2")

If answer = 6 Then
Sheets("Document #1 and #2").Select
Application.Goto Reference:="hello"
    Else
Application.Goto Reference:="hello2"
ActiveWindow.ScrollColumn = 15

End If


End Sub

Private Sub CommandButton2_Click()

Sheets("Movement Image").Select
Application.Goto Reference:="hello3"

End Sub

Private Sub CommandButton3_Click()
Sheets("System Booking #1 and #2").Select
Application.Goto Reference:="hello4"

End Sub

Private Sub CommandButton4_Click()
Sheets("Filepath").Select
Application.Goto Reference:="hello5"
End Sub

Private Sub CommandButton5_Click()
Sheets("What it looks like on documenta").Select
Application.Goto Reference:="hello6"
End Sub

Private Sub CommandButton6_Click()

Call ok2

End Sub


Sub ok2()

value1 = Range("AZ1").value
value2 = Range("AZ2").value
value3 = Range("AZ3").value
value4 = Range("AZ4").value

ActiveWorkbook.SaveAs Filename:="C:\Users\18622\OneDrive\Desktop\VBA Lessons\" & value1 & value2 & value3 & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

Workbooks("Documentation.xlsm").Activate

Range("D" & value4).value = "C:\Users\18622\OneDrive\Desktop\VBA Lessons\" & value1 & value2 & value3 & ".xlsm"
Range("E" & value4).Select
ActiveCell.FormulaR1C1 = "=hyperlink(RC[-1])"


Workbooks(value1 & value2 & value3 & ".xlsm").Close False

End Sub

Comments are closed.