Correct sytax to resize cells

  • My routine needs to resize a single cell consecutively to 2 rows, then 3, etc. According to resource I've checked the correct code is simple enough:


    Code
    Range("B3").Resize(RowSize:=2)


    When I can get it to work, will be changed to

    Code
    Range("B3").Resize(RowSize:=n+1)


    But this and everything else I've tried throws up the error "Expected: = "


    What am I doing wrong? Using Excel 2003.


    Thanks in anticipation.

  • Re: Correct sytax to resize cells


    It is asking ACTION.


    That line alone is just referring the range, so you need to add action like

    Code
    Range("B3").Resize(RowSize:=2).Value = "Hello"


    Or other setting like

    Code
    dim myrng as range
    set myrng = Range("B3").Resize(RowSize:=2)
  • Re: Correct sytax to resize cells


    Hi, goneps,


    maybe you give this a try:

    Code
    Dim lngResRow As Long
    
    
    For lngResRow = 2 To 4
      Range("A3").Resize(lngResRow, Columns.Count).Select
    Next lngResRow


    Code
    Range("A3").EntireRow.Resize(2, Columns.Count).Select


    The Select is just for showing the effects on that.


    Ciao,
    Holger

  • Re: Correct sytax to resize cells


    Jindon & Holger,


    Simple, when you know how. Many, many thanks indeed! You've saved this poor soul from a spell in the nut house.


    Richard

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!