Resize row height vba excel

Solved
Hello,
I would like to resize the height of a row in Excel using VBA, but I can't find a solution. If anyone has an idea, thank you in advance!

Configuration: Windows XP

2 answers

  • Votes
  • Date
  • Descending date
  1. Sub Macro() Feuil1.Rows("1:1").RowHeight = 15 End Sub


    In a module, enter this program (to be modified according to the sheet and the row). You can then call this program using a button, depending on what you want to do exactly. With this example, you modify the height of row 1 of Sheet1 of your workbook, setting it to a height of 15.
    1. Thank you very much, it works very well; however, I can't replace the line number with a variable.
    2. There is actually no need for quotes in the parentheses of Rows.
      You can do it directly like this:

      Sub Macro4()
      For i = 1 To 10
      Feuil1.Rows(i).RowHeight = 15
      Next i
      End Sub
    3. Thank you, it's perfect! Just one last question, lol. I have the following code:

      Feuil5.Range("A68:I68").Interior.Color = 1

      I would like to replace the 68 in the row number with a variable, but I don't know the syntax either.
    4. Try using cells instead of range,
      Something like

      For i = 1 to 68 'row 1 to 68
      For j = 1 to 8 'column A to I
      Sheet5.Cells(i,j).Interior.Color = 1
      Next j
      Next i
    5. Super, it was great! Thank you very much for giving me a bit of your time. Have a nice day!