excel - Clear dynamic range vba -


i trying clear dynamic range starting on cell m22 using , going last column use of last column eluding me.

thanks

sub clear() workbooks.open filename:=thisworkbook.path & "\..\master info page.xlsx"     sheets("sheet1")     lastcol = .cells(13, .columns.count).end(xltoleft).column     lastrow = .cells(.rows.count, lastcol).end(xlup).row   end  sheets("sheet1").range(cells(m22, 13), cells(lastrow, lastcol)).clear  end sub 

couldn't do:

with sheets("sheet1")     .range("m22", .cells(.rows.count, .columns.count)).clear end 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -