Removing External Data

M

MEG

I have a spreadsheet that retrieves external data from a SQL Server database.
The user clicks a button that executes a macro. The table returned has a
named range.

I want to provide a button to REMOVE the data. Can someone point me to an
example of how to remove the data (ideally using the named range, but will be
happy with any example completing the task).

Thanks,

MEG
 
D

Doug Robbins - Word MVP

Assuming that you are talking about Excel, you would be best posting such
questions the the microsoft.public.excel.programming newsgroup. However,
the following code in an Excel macro will erase the data from the cells in a
Range named "rangename"

Dim i As Long, j As Long
For i = 1 To Range("rangename").Rows.Count
For j = 1 To Range("rangename").Columns.Count
Range("rangename").Cells(i, j).Value = ""
Next j
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Top