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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top