Sunday, 26 March 2023

How to Make Folder from excel

Today we know that How to make folder from excel

To create a folder from an Excel file, you can follow these steps:

  1.  Open the File Explorer on your computer
  2. Navigate to the location where you want to create the new folder.
  3. Right-click on the empty space in the File Explorer window and select "New" from the context menu.
  4. Select "Folder" from the sub-menu that appears.
  5. Give the folder a name that you want to use.
  6. Press Enter to create the folder.

Alternatively, if you want to create a folder using data from an Excel file, you can use a VBA macro to automate the process. Here is an example macro that creates a new folder using data from cell A1 in the active worksheet:







Press Alt+F11 to open the Visual Basic Editor.

Select "Insert" from the menu bar and choose "Module."

Paste the following code into the code window:

Folder creation code:--

Sub MakeFolders()

Dim Rng As Range

Dim maxRows, maxCols, r, c As Integer

Set Rng = Selection

maxRows = Rng.Rows.Count

maxCols = Rng.Columns.Count

For c = 1 To maxCols

r = 1

Do While r <= maxRows

If Len(Dir(ActiveWorkbook.Path & "\" & Rng(r, c), vbDirectory)) = 0 Then

MkDir (ActiveWorkbook.Path & "\" & Rng(r, c))

On Error Resume Next

End If

r = r + 1

Loop

Next c

End Sub

Press F5 or click the "Run" button to execute the macro. When the macro runs, it creates a new folder with the name specified in cell A1 of the active worksheet. You can modify the code to use a different cell reference or to create multiple folders at once if needed.

1 comment: