Hi all, I just started teaching myself VBA this past week. Currently, I'm trying to write a code that pulls information from cells in Excel to rename a folder. My excel worksheet looks like this:
Column A: Source of Folder Path
Column B: Source of Folder Path NEW
This is the code that I've found/developed--the name statement seems to work, but I don't know how to loop it or make it pull information from excel.
Sub FolderRename()
'Declaring variables
Dim complete_pathof_folder As String, state As String
'Variable values
complete_pathof_folder = Cells(2, 2)
state = Cells(2, 5)
'Renames Original Folder Name
Name "C:\Users\n0269632\Desktop\Customers\AFL TELECOMMUNICATIONS" As "C:\Users\n0269632\Desktop\Customers\AFL TELECOMMUNICATIONS (SC)"
'Repeats Code Until an Empty Cell is Reached
Do Until IsEmpty(Cells(iRow, 1))
dCellValues(iRow) = Cells(iRow, 2).Value
iRow = iRow + 1
Loop
End Sub
I believe the Dim code would pull information from excel and the loop function would loop it--obviously--but I don't know where to put it. Any help would be truly appreciated. Thank you!
Column A: Source of Folder Path
Column B: Source of Folder Path NEW
This is the code that I've found/developed--the name statement seems to work, but I don't know how to loop it or make it pull information from excel.
Sub FolderRename()
'Declaring variables
Dim complete_pathof_folder As String, state As String
'Variable values
complete_pathof_folder = Cells(2, 2)
state = Cells(2, 5)
'Renames Original Folder Name
Name "C:\Users\n0269632\Desktop\Customers\AFL TELECOMMUNICATIONS" As "C:\Users\n0269632\Desktop\Customers\AFL TELECOMMUNICATIONS (SC)"
'Repeats Code Until an Empty Cell is Reached
Do Until IsEmpty(Cells(iRow, 1))
dCellValues(iRow) = Cells(iRow, 2).Value
iRow = iRow + 1
Loop
End Sub
I believe the Dim code would pull information from excel and the loop function would loop it--obviously--but I don't know where to put it. Any help would be truly appreciated. Thank you!