+ Reply to Thread
Results 1 to 4 of 4

VBA code to set row height if a cell contains text (e.g., "----------")

  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    Ft. Laudderdale, Florida
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question VBA code to set row height if a cell contains text (e.g., "----------")

    Hello,
    I am not familiar at all with VBA, but have learned to record a macro and then edit the contents in VBA. I have a daily report that I make modifications to in order to highlight key cells and such. After I run my macro, I get some header rows that are too high, and would love to reduce the height for these header rows. My header rows contain the text "----------". That being said, I cannot figure out how to write an IF THEN code to make this happen. What I have is below. Please help. Thank you in advance.

    Sub row_height()
    With Application.ReplaceFormat.Interior
    For Each cell In ActiveSheet.UsedRange
    If cell.Value = "----------" Then Rows.RowHeight = 20.4
    End With

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA code to set row height if a cell contains text (e.g., "----------")

    Possibly...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-18-2012
    Location
    Ft. Laudderdale, Florida
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: VBA code to set row height if a cell contains text (e.g., "----------")

    Absolutely amazing. It worked like a charm. THANK YOU!!!

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA code to set row height if a cell contains text (e.g., "----------")

    Glad to hear it!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hyperlink click "cell text" to next sheet and auto filter by the "same clicked text" VBA
    By determinedtoexceed in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2021, 06:27 AM
  2. [SOLVED] Unable to Make FIFO Code work If I change text From "Bought" to "Buy"
    By onp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-26-2021, 11:00 AM
  3. Replies: 4
    Last Post: 06-11-2017, 02:03 PM
  4. [SOLVED] Code that copies row of data to another sheet based on text "Complete"/"Delete"
    By Dremzy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-20-2014, 05:51 PM
  5. Replies: 2
    Last Post: 04-20-2014, 11:18 AM
  6. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  7. [SOLVED] Do mighty exchange "pixels" on "mm" - cells (width, height)? :(
    By And1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-01-2006, 08:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1