Clear worksheet

How do I clear a worksheet before copying new data?

1 Like

I think write range should take care of it.no need of clearing.

1 Like

I am using write range, and starting Cell as A2. However the earlier data is not getting cleared.
The macro I run with old data gives validation error.

@KingTut2010 Please find attached solution. It can be accomplished by workbookapplication but you need to set the sheet.

emptyDT.xaml (7.6 KB)

COuld you provide an example? EMpty datatable is throwing an exception.

Attached

Can I just instantiate an empty datatable and assign that to the write range activity ?

Tried that doesn’t seem to work. If you don’t want to go with the solution I provided, another idea is to implement Hot Keys.

1 Like

Can you share a sample with hotkeys? you mentioned that the write range should have cleared the range before writing however that is not happenning. ANy idea why ?

emptyDT.xaml (12.0 KB)

3 Likes

Thanks vvaidya, this is great!

You need to provide the selector for the excel document, for the first hot key activity at least. Else it won’t work. At least it didn’t work for me.

You can use Select Range.

image

or

1 Like

This is very helpful! thank you