mary_anderson
11 years agoNew Contributor
Excel Ranges - Using Column Numbers rather than letters
Hi all, As part of one of my routines, I'd like to "Clear Contents" of a range in Excel, using the COM object. However, I'd like to use numbers to represent the columns rather than letters. I...
- 11 years agoTry this:
Sub clearRange
set xl = Sys.OleObject("Excel.Application")
xl.Visible = TRUE
Set workbook = xl.ActiveWorkbook
Set worksheet = workbook.ActiveSheet
Set range1 = worksheet.Range(worksheet.Cells(11, 8), worksheet.Cells(15, 12))
range1.clearContents
End Sub