ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If ...Then Statement (https://www.excelbanter.com/excel-programming/409864-if-then-statement.html)

Scottie

If ...Then Statement
 
Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie

Dave Peterson

If ...Then Statement
 
Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie


--

Dave Peterson

Scottie

If ...Then Statement
 
actually it is on a seperate sheet called "setup"


"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie


--

Dave Peterson


Don Guillett

If ...Then Statement
 
A WORKSHEET_change event works on changing something on the worksheet of the
macro module. So.....

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scottie" wrote in message
...
actually it is on a seperate sheet called "setup"


"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with
a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie


--

Dave Peterson



Scottie

If ...Then Statement
 
Dave,

Using your structure...I managed to figure it out...

but is it correctly done?

Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Setup").Range("dailyupdate").Value = True Then SortThem
End Sub

Thanks

"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie


--

Dave Peterson


Scottie

If ...Then Statement
 
That seems correct Don, but can't it call something else? For example .....
another procedure?

"Don Guillett" wrote:

A WORKSHEET_change event works on changing something on the worksheet of the
macro module. So.....

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scottie" wrote in message
...
actually it is on a seperate sheet called "setup"


"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with
a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie

--

Dave Peterson




Dave Peterson

If ...Then Statement
 
The code is under the worksheet that holds the DailyUpdate cell?

And the subroutine called SortThem sorts the other worksheet?

Without seeing that SortThem macro (and how the data is laid out), it might be
perfect--or it could be bad <vbg.

Did it work correctly for you?

If yes, then I'd say it was perfect!

If no, then post back with the details of the SortThem macro and a little info
on how that data is laid out.

Scottie wrote:

Dave,

Using your structure...I managed to figure it out...

but is it correctly done?

Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Setup").Range("dailyupdate").Value = True Then SortThem
End Sub

Thanks

"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie


--

Dave Peterson


--

Dave Peterson

Scottie

If ...Then Statement
 
Dave,

I actually posted that code in here because I knew one of you guys would
spot the problem right away and correct me :) The SortThem procedure works
fine and yes it actually sorts 3 other worksheets, and now it does it based
on a flag in my setup sheet. I suppose I could have said that in the first
case.

I don't think I really want to embarass myself further by showing you that
code also...I really have no idea what I am doing. I learn the code from
google and the macro recorder, so I don't understand all concepts :)

But thanks ... it works and I learned how

Scottie







"Dave Peterson" wrote:

The code is under the worksheet that holds the DailyUpdate cell?

And the subroutine called SortThem sorts the other worksheet?

Without seeing that SortThem macro (and how the data is laid out), it might be
perfect--or it could be bad <vbg.

Did it work correctly for you?

If yes, then I'd say it was perfect!

If no, then post back with the details of the SortThem macro and a little info
on how that data is laid out.

Scottie wrote:

Dave,

Using your structure...I managed to figure it out...

but is it correctly done?

Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Setup").Range("dailyupdate").Value = True Then SortThem
End Sub

Thanks

"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie

--

Dave Peterson


--

Dave Peterson


Dave Peterson

If ...Then Statement
 
Glad you got it working.

But you've got to develop a thicker skin <vbg.

You'll soon learn to say "thanks for the help" and maybe walk away with code
that's a little easier to understand. It's something that can make you more
efficient in your coding, too.

Every once in awhile, I'll visit the .worksheet.functions newsgroup. I truly
believe that some of those people have brains that just work differently than me
(and most normal people!).

I'll post my do this and then do that and try this. And then one of those smart
guys/gals will come in and say:

Or you could just use....

Embarrassing? Not as much as before <bg. I just hope my post ages off really
quickly.


Scottie wrote:

Dave,

I actually posted that code in here because I knew one of you guys would
spot the problem right away and correct me :) The SortThem procedure works
fine and yes it actually sorts 3 other worksheets, and now it does it based
on a flag in my setup sheet. I suppose I could have said that in the first
case.

I don't think I really want to embarass myself further by showing you that
code also...I really have no idea what I am doing. I learn the code from
google and the macro recorder, so I don't understand all concepts :)

But thanks ... it works and I learned how

Scottie

"Dave Peterson" wrote:

The code is under the worksheet that holds the DailyUpdate cell?

And the subroutine called SortThem sorts the other worksheet?

Without seeing that SortThem macro (and how the data is laid out), it might be
perfect--or it could be bad <vbg.

Did it work correctly for you?

If yes, then I'd say it was perfect!

If no, then post back with the details of the SortThem macro and a little info
on how that data is laid out.

Scottie wrote:

Dave,

Using your structure...I managed to figure it out...

but is it correctly done?

Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Setup").Range("dailyupdate").Value = True Then SortThem
End Sub

Thanks

"Dave Peterson" wrote:

Maybe...
Private Sub Worksheet_Change(ByVal Target As Range)
If me.range("dailyupdate").value = True Then SortThem
End Sub

DailyUpdate is a named range (single cell) on the same sheet?

Scottie wrote:

Group,

I have a worksheet change evenet that I want to be able to toggle with a
named cell value.

Private Sub Worksheet_Change(ByVal Target As Range)
If dailyupdate = True Then SortThem
End Sub

NO errors, but it doesn't run.......I am totally lost as to how to fix
it.... I know there is something missing

If the value is false, I want it to just fail and stop.

Please help :)

Thanks in advance.....

Scottie

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 09:34 AM.

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