ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select cell at random and delete contents (https://www.excelbanter.com/excel-programming/338910-select-cell-random-delete-contents.html)

JJ[_8_]

select cell at random and delete contents
 
If someone could me with this I'd very grateful.

Select one cell at random in the range A2:J10 and delete the value.

Borders to be left intact.



Rowan[_4_]

select cell at random and delete contents
 
Try:

Sub delsome()
Dim n As Integer
n = Int(9 * Rnd + 1)
Range("J2:J10").Cells(n).ClearContents
End Sub

Hope this helps
Rowan

"JJ" wrote:

If someone could me with this I'd very grateful.

Select one cell at random in the range A2:J10 and delete the value.

Borders to be left intact.




JJ[_8_]

select cell at random and delete contents
 
Sub PickRndCell()
Dim Table As Range
Dim cell As Integer, i As Integer
Set Table = Range("B6:E11")
i = Table.Cells.Count
cell = Int(Rnd() * i)
Table.Cells(cell).Select
End Sub


"JJ" wrote in message
...
If someone could me with this I'd very grateful.

Select one cell at random in the range A2:J10 and delete the value.

Borders to be left intact.






All times are GMT +1. The time now is 11:28 PM.

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