2

When I try to get the row height the returned value varies from the height in the spreadsheet. I have the row height for row 5 set to 10 but when I use the code;

Sub RowHeightTest()

    MsgBox Rows(5).Height

End Sub

it returns 9.75 if I change the height to 20 I get 19.5, why is there a difference?

1 Answer 1

2

Try this instead.

Sub RowHeightTest()

    MsgBox Rows(5).RowHeight

End Sub

Yours gives me the same issue, mine works fine for me.

Make sure you're using ROWHEIGHT, not HEIGHT.

excel showing row height set

Yours: Your non-working answer

Mine: My working answer

6
  • Same incorrect result, did it work for you? Commented Oct 19, 2020 at 12:31
  • @Naz yes it works for me, I added picture proof to the answer. Please re-read my full answer as I believe your issue is Height vs RowHeight Commented Oct 19, 2020 at 12:55
  • MsgBox Rows(1).RowHeight also works. Your problem is using Height instead of RowHeight. Please accept this answer once you can confirm. Commented Oct 19, 2020 at 12:57
  • This answer is correct. Commented Oct 19, 2020 at 13:04
  • 1
    My bad didn't notice the RowHeight. Commented Oct 19, 2020 at 13:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.