di leo21583 » 03/01/12 15:09
Vi ringrazio,
ho provato a fare le modifiche che mi avete suggerito ma.. Ho provato a commentare la parte di codice con il With ma a quel punto ho il problema che restano selezionate delle celle per via dei comandi Rows.Select. Esiste un comando inverso a Rows.select? Ho provato con Deselect e Unselect ma non vanno! Per farvi capire di cosa parlo vi posto una parte piu ampia del codice su cui sto lavorando.. Quello che vorrei è che quando agisco su una cella qualsiasi il foglio non si sposti altrove e non restino selezionate altre celle! Qualsiasi suggerimento sarà ben gradito..
If Cells(244, 1) = "TRW Nelson KB" Then
Rows("256:256").Select
Selection.EntireRow.Hidden = True
Rows("245:251").Select
Selection.EntireRow.Hidden = False
Rows("254:255").Select
Selection.EntireRow.Hidden = False
Rows("257:257").Select
Selection.EntireRow.Hidden = False
Range("B244").Select
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With Range("B244").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=SCList"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Rows("1:1").Select
ElseIf Cells(244, 1) = "Others" Then
Rows("256:256").Select
Selection.EntireRow.Hidden = False
Range("B244").Select
Rows("245:251").Select
Selection.EntireRow.Hidden = True
Rows("254:255").Select
Selection.EntireRow.Hidden = True
Rows("257:257").Select
Selection.EntireRow.Hidden = True
With Range("B244").Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("B244").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
End If