Hi All
New to this forum and VBA macros, so bare over with me =)
I need a macro that can create a folder in the same destination as the excel file it self. This location can change so the it can´t be a specific location as it will change?
Plus is it possible to name the folder after a few cells value?
I have a button that opens a userform to enter data to a list. This folder should be created at the same time as the new data is entered to the list.
This is the macro that runs for the "Add Project", which is a mess and I´m as said really green into macro =)
Let me know if it is possible
"
Private Sub addProject_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Ark1")
Sheets("Ark1").Range("A8").Select
ActiveCell.EntireRow.Insert shift:=xlDown
Sheets("Ark1").Range("B8:I8").Select
Selection.Borders.Weight = xlThin
Sheets("Ark1").Range("B8:I8").Select
Selection.Font.Size = 11
Sheets("Ark1").Range("B8:I8").Select
Selection.Font.Bold = False
Sheets("Ark1").Range("B8").Select
ActiveCell.Value = Range("B9") + 1
Sheets("Ark1").Range("E8").Select
ActiveCell.Value = Date
With ws
Sheets("Ark1").Range("C8").Select
ActiveCell.Value = Me.TextBox1.Value
Sheets("Ark1").Range("D8").Select
ActiveCell.Value = Me.TextBox2.Value
Sheets("Ark1").Range("F8").Select
ActiveCell.Value = Me.TextBox3.Value
Sheets("Ark1").Range("G8").Select
ActiveCell.Value = Me.TextBox4.Value
Sheets("Ark1").Range("H8").Select
ActiveCell.Value = Me.TextBox5.Value
Sheets("Ark1").Range("I8").Select
ActiveCell.Value = Me.TextBox6.Value
End With
'clear the data
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""
Me.TextBox6.Value = ""
Me.TextBox1.SetFocus
Unload Me
End Sub
Private Sub closeButton_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
"
New to this forum and VBA macros, so bare over with me =)
I need a macro that can create a folder in the same destination as the excel file it self. This location can change so the it can´t be a specific location as it will change?
Plus is it possible to name the folder after a few cells value?
I have a button that opens a userform to enter data to a list. This folder should be created at the same time as the new data is entered to the list.
This is the macro that runs for the "Add Project", which is a mess and I´m as said really green into macro =)
Let me know if it is possible
"
Private Sub addProject_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Ark1")
Sheets("Ark1").Range("A8").Select
ActiveCell.EntireRow.Insert shift:=xlDown
Sheets("Ark1").Range("B8:I8").Select
Selection.Borders.Weight = xlThin
Sheets("Ark1").Range("B8:I8").Select
Selection.Font.Size = 11
Sheets("Ark1").Range("B8:I8").Select
Selection.Font.Bold = False
Sheets("Ark1").Range("B8").Select
ActiveCell.Value = Range("B9") + 1
Sheets("Ark1").Range("E8").Select
ActiveCell.Value = Date
With ws
Sheets("Ark1").Range("C8").Select
ActiveCell.Value = Me.TextBox1.Value
Sheets("Ark1").Range("D8").Select
ActiveCell.Value = Me.TextBox2.Value
Sheets("Ark1").Range("F8").Select
ActiveCell.Value = Me.TextBox3.Value
Sheets("Ark1").Range("G8").Select
ActiveCell.Value = Me.TextBox4.Value
Sheets("Ark1").Range("H8").Select
ActiveCell.Value = Me.TextBox5.Value
Sheets("Ark1").Range("I8").Select
ActiveCell.Value = Me.TextBox6.Value
End With
'clear the data
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""
Me.TextBox6.Value = ""
Me.TextBox1.SetFocus
Unload Me
End Sub
Private Sub closeButton_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
"