From: MEG on
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
From: Doug Robbins - Word MVP on
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

"MEG" <MEG(a)discussions.microsoft.com> wrote in message
news:335535EC-C19C-45AE-AA64-92107CDFD465(a)microsoft.com...
> 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