Excel VBA Macro: Capitalize First Letter of Every Word in a (Static/Dynamic) Range of Strings

preview_player
Показать описание
Excel VBA Macro: Capitalize First Letter of Every Word in a (Static/Dynamic) Range of Strings

Code:

Sub cap_words_in_string()

Dim word As Range
Dim ws As Worksheet
Dim row_count As Long
Dim col_count As Long

Set ws = ThisWorkbook.Sheets("Sheet2")

ws.Activate

row_count = ws.Cells(Rows.Count, 1).End(xlUp).Row
col_count = ws.Cells(1, Columns.Count).End(xlToLeft).Column

For Each word In Range(Cells(1, 1), Cells(row_count, col_count))

word.Value = StrConv(word.Value, vbProperCase)

Next word

End Sub

#excelmacro #excelvba
Рекомендации по теме
Комментарии
Автор

I have a folder with emails saved. Each email contains a zip folder that contains csv files. Can you do a video on how to go through all the emails, unzip the files and consolidate the csv files into one csv file using vba/macro?

andyw.