Prev: Macro to change column width and active window zoom as columns are selected
Next: Link error/Warning using macro in files converted to Excel 2007 (.
From: Rick Rothstein on 21 Apr 2010 13:14 Perhaps I should mention, for clarity sake, that the number 65 in the Resize property call is the numeric value for Column BM (which was the ending column that the OP indicated the data should be cleared up to). -- Rick (MVP - Excel) "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in message news:Oqn3oRX4KHA.4332(a)TK2MSFTNGP02.phx.gbl... > Does this macro do what you want? > > Sub ClearAfterRowOneData() > Dim LastRowOneColumn As Long > LastRowOneColumn = Cells(1, Columns.Count).End(xlToLeft).Column > Columns(LastRowOneColumn + 1).Resize(, 65 - LastRowOneColumn).Clear > End Sub > > -- > Rick (MVP - Excel) > > > > "BlueAngel" <BlueAngel(a)discussions.microsoft.com> wrote in message > news:0794F0F3-A73B-4ED9-A99C-9CE6D66B46F5(a)microsoft.com... >> I have a sheet that has formatting pre set for Columns A:BM. My data key >> will be row 1. I need to clear all data in all rows to the right of >> where >> row 1 data ends. >> >> Example: >> >> >> Col A Col B Col c Col D Col E >> Row >> 1 Data Data Data >> >> >> Data population ends in Cell C1, Clear all data D:BM. >> >> >> Col A Col B Col c Col D Col E >> Row >> 1 Data Data Data Data >> >> Data population end in Cell D1, Clear all data E:BM >> >> Can someone help with VBA that will automatically clear this? >> >> Thanks in advance, > |