Click to See Complete Forum and Search --> : VBA Excel question ???


trasher
September 6th, 2001, 07:15 AM
is it possible to affect a specific cell value to the name of its worksheet ?

Make it with rocker style \w/

Cakkie
September 6th, 2001, 07:18 AM
If you mean you want to affect a cell on a specific worksheet?

' myWorkbook is an object pointing to an excel workbook
myWorkbook.Sheets("The name of my sheet").Range("A1").Value = "Some value"




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

trasher
September 6th, 2001, 07:31 AM
huumm
I want to change the value of the sheet's name with the value of the cell.
For example. my sheets "number1" contains 10 cells (A2, A3, A4, A5, A6,...)
if I change the value of the cell "A2", then, it change the name of the sheets "number2" also..

I want to link these 2 values.

Make it with rocker style \w/

Cakkie
September 6th, 2001, 07:52 AM
Add this code to the worksheet the cells are on. It will check if one of the cells changes, and then rename the appropriate sheet

private Sub Worksheet_Change(byval Target as Excel.Range)

If Target.Column = 1 then
Select Case Target.Row
Case 2 to 10
ThisWorkbook.Sheets(Target.Row).Name = Target.Value
End Select
End If

End Sub




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

trasher
September 6th, 2001, 08:50 AM
yeah,
that's exactly what I wanted to do.
thanks, :O)

Make it with rocker style \w/