ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   programming in excel (https://www.excelbanter.com/excel-programming/384883-programming-excel.html)

SMM

programming in excel
 
ive got 10 cell numbered from 1 to 10 A1 to A10 then ive got 1 cell C5 if
i put a number in cell C5 1 to 10 it will put a x in the cell 1 to 10
excemple
i put number 5 in cell c5 then in cell number 5 (A5) number a X will appear
i put number 4 in cell c5 then in cell number 4 (A4) number a X will appear

Vergel Adriano

programming in excel
 
Something like this in the worksheet code module to trap the worksheet_change
event.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$C$5" Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
If Target.Value = 1 And Target.Value <= 10 Then
Range("A" & Target.Value).Value = "X"
End If
End Sub



"smm" wrote:

ive got 10 cell numbered from 1 to 10 A1 to A10 then ive got 1 cell C5 if
i put a number in cell C5 1 to 10 it will put a x in the cell 1 to 10
excemple
i put number 5 in cell c5 then in cell number 5 (A5) number a X will appear
i put number 4 in cell c5 then in cell number 4 (A4) number a X will appear


Martin Fishlock

programming in excel
 
You can also do it with worksheetfunctions

in a1 put

=if($c$5=row(),"X","")

and copy down into cells a2:a10.

Enter the number in C5 and the x appears.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Vergel Adriano" wrote:

Something like this in the worksheet code module to trap the worksheet_change
event.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$C$5" Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
If Target.Value = 1 And Target.Value <= 10 Then
Range("A" & Target.Value).Value = "X"
End If
End Sub



"smm" wrote:

ive got 10 cell numbered from 1 to 10 A1 to A10 then ive got 1 cell C5 if
i put a number in cell C5 1 to 10 it will put a x in the cell 1 to 10
excemple
i put number 5 in cell c5 then in cell number 5 (A5) number a X will appear
i put number 4 in cell c5 then in cell number 4 (A4) number a X will appear



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

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