ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code Help!! PLEASE (https://www.excelbanter.com/excel-programming/391263-code-help-please.html)

N.F[_2_]

Code Help!! PLEASE
 
Does any one knows why this is not working?


Private Sub ComboBox1_Change()
if me.combobox1.value = "value1" then
With Me.ComboBox1.TopLeftCell
..Offset(0, 5) = "NIN"
..Offset(0, 6) = "NOUT"
..Offset(0, 7) = "IND"
..Offset(0, 8) = "TITLE"
..Offset(0, 9) = "CASE"
End With
else
With Me.ComboBox1.TopLeftCell
..Offset(0, 5) = "something"
..Offset(0, 6) = "else"
..Offset(0, 7) = "more"
..Offset(0, 8) = "ofmy"
..Offset(0, 9) = "stuff"
End With

End Sub


Any Help Greatly appreciated.
Do I need an End If somewhere?

GS

Code Help!! PLEASE
 
Yes, you're missing an End If!

You could try this:

Private Sub ComboBox1_Change()
With Me.ComboBox1.TopLeftCell
If Me.ComboBox1.Value = "value1" Then
.Offset(0, 5) = "NIN"
.Offset(0, 6) = "NOUT"
.Offset(0, 7) = "IND"
.Offset(0, 8) = "TITLE"
.Offset(0, 9) = "CASE"
Else
.Offset(0, 5) = "something"
.Offset(0, 6) = "else"
.Offset(0, 7) = "more"
.Offset(0, 8) = "ofmy"
.Offset(0, 9) = "stuff"
End If
End With
End Sub

hth
Garry


All times are GMT +1. The time now is 07:43 PM.

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