Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to create a function that will, given a worksheet (passed byRef), and
given a start row, that will clear all of the cells from column D, and the given row, all the way down (and right) to the bottom of the data. Then it will select the first cell (column D, and the given starting row) and end the function. I've got something like that created, but every time I try to get it to select from the first cell to the last, I get a "Application-defined or object-defined error". What am I missing? The code is as follows: Sub ClearWorksheet(ByRef ws As Worksheet, ByVal intStartRow As Integer) Dim tempString As String tempString = "D" & CStr(intStartRow) ws.Range(tempString, Application.ActiveCell.SpecialCells(xlLastCell)).S elect ' This is the line giving me the Application-defined error Selection.ClearContents ws.Range("D" & CStr(intStartRow)).Select End Sub Thanks! -Scott |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create Pivot Table Data with Column "Sum" rather than "count" defa | Excel Discussion (Misc queries) | |||
How do I search a worksheet for a custom "text" max and min value | Excel Discussion (Misc queries) | |||
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error | Excel Discussion (Misc queries) | |||
create links to check boxes marked "good" fair"and "bad" | Excel Worksheet Functions | |||
Adding a "CLEAR" button to the worksheet | Excel Discussion (Misc queries) |