ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to delete different data from different cell at a time and lea (https://www.excelbanter.com/excel-programming/362308-how-delete-different-data-different-cell-time-lea.html)

MADDY

how to delete different data from different cell at a time and lea
 
some data in da same cell

Tom Ogilvy

how to delete different data from different cell at a time and lea
 
Test this on a copy of your workbook

Select a single rectangular area of cells containing data, then run this macro

Sub DeleteandLeave()
'
' Randomly deletes some data in different cells at the
' time of running while leaving other data in da same cell
' Note: unconstrained by the value in the cell
'
Set rng = Selection
For k = 1 To Int(Rnd() * rng.Rows.Count * rng.Columns.Count + 1)
i = Int(Rnd() * rng.Rows.Count + 1)
j = Int(Rnd() * rng.Columns.Count + 1)
rng.Cells(i, j).ClearContents
Next k
End Sub


This may not be exactly what you want, but hopefully it "shows the way".

--
Regards,
Tom Ogilvy


"maddy" wrote:

some data in da same cell



All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com