View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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