Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
dela_dela la Simpatie.ro
Femeie
24 ani
Bucuresti
cauta Barbat
24 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Find Widths of Selected Columns / Height for Rows [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 787
For some reason I want to know the total width of 5 columns in a range.
This could easily be calculated by summing up their widths manually, sure. But I might need to do this again. And again.

Find width of selected columns (letting VBA sum up each column's width):

Sub Find_Col_Widths()

Dim i As Integer
Dim s As Double
    s = 0
   
For i = 1 To Selection.Columns.Count
    s = s + Selection.Columns(i).ColumnWidth
Next i

MsgBox s

End Sub


Find height of selected rows (letting VBA sum up each row's height):

Sub Find_Row_Height()

Dim i As Integer
Dim s As Double
    s = 0
   
For i = 1 To Selection.Rows.Count
    s = s + Selection.Rows(i).RowHeight
Next i

MsgBox s

End Sub


pus acum 4 ani
   
Pagini: 1  

Mergi la