I'm trying to add "#" in each cell in the first column since Row7 until the cell is blank. And I have several files in one folder which needs to repeat. Is it possible to do this by VBA? It always shown, there's something wrong with the code. Many thanks for help.
Sub LoopAllFilesInAFolder()
'Loop through all files in a folder
Dim fileName As Variant
fileName = Dir("C:\Users)
While fileName <> ""
'Insert the actions to be performed on each file
Dim last As Long
Dim i As Long
'Find the last row with values in Column A
last = .Cells(.Rows.Count, 1).End(xlUp).Row
'Loop from the 7th row to the last row.
For i = 7 To last
'Assign the value
Cells(i, 1).Value = "#" & Cells(i, 1).Value
Next i
'This example will print the file name to the immediate window
Debug.Print fileName
'Set the fileName to the next file
fileName = Dir
Wend
End Sub
