From: hshayh0rn on
I have a very basic question but I can't seem to find the answer on here
(probably to basic). I have a spreadsheet that I would like to perform all of
my calculations / If / Then statements using VBA but I'm not sure how to
actually get the code to run or where to put it to run... I can get all of
the code to run with an on click event or something like that but basically
I'd like cells to automatically fill in other cells based on values the users
put in them. For example:

If sheet2!.cells(12,3) = "N" Then

Sheet3!.cells(3,2) = "Sold Out"

or

If sheet2!.cells(12,3) = "Y" Then

Sheet3!.Visible = False

I'll keep searching for the answers to this question but if someone could
shoot me a quick answer I would appreciate it.
From: Bob Phillips on
Sub myMacro()
If Worksheet("Sheet2").cells(12,3) = "N" Then
Worksheet("Sheet3").cells(3,2) = "Sold Out"
ElseIf Worksheet("Sheet2").cells(12,3) = "Y" Then
Worksheet("Sheet3").Visible = False
End If
End Sub

This would be an on-demand macro, stored in a standard code module.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"hshayh0rn" <hshayh0rn(a)discussions.microsoft.com> wrote in message
news:A01F93A5-C8A4-479D-AF14-E6A4DF0C0228(a)microsoft.com...
> I have a very basic question but I can't seem to find the answer on here
> (probably to basic). I have a spreadsheet that I would like to perform all
of
> my calculations / If / Then statements using VBA but I'm not sure how to
> actually get the code to run or where to put it to run... I can get all of
> the code to run with an on click event or something like that but
basically
> I'd like cells to automatically fill in other cells based on values the
users
> put in them. For example:
>
> If sheet2!.cells(12,3) = "N" Then
>
> Sheet3!.cells(3,2) = "Sold Out"
>
> or
>
> If sheet2!.cells(12,3) = "Y" Then
>
> Sheet3!.Visible = False
>
> I'll keep searching for the answers to this question but if someone could
> shoot me a quick answer I would appreciate it.


From: hshayh0rn on
Thanks for the reply... So, would the user have to run the macro manually or
does excel know to run this on its own?

"Bob Phillips" wrote:

> Sub myMacro()
> If Worksheet("Sheet2").cells(12,3) = "N" Then
> Worksheet("Sheet3").cells(3,2) = "Sold Out"
> ElseIf Worksheet("Sheet2").cells(12,3) = "Y" Then
> Worksheet("Sheet3").Visible = False
> End If
> End Sub
>
> This would be an on-demand macro, stored in a standard code module.
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "hshayh0rn" <hshayh0rn(a)discussions.microsoft.com> wrote in message
> news:A01F93A5-C8A4-479D-AF14-E6A4DF0C0228(a)microsoft.com...
> > I have a very basic question but I can't seem to find the answer on here
> > (probably to basic). I have a spreadsheet that I would like to perform all
> of
> > my calculations / If / Then statements using VBA but I'm not sure how to
> > actually get the code to run or where to put it to run... I can get all of
> > the code to run with an on click event or something like that but
> basically
> > I'd like cells to automatically fill in other cells based on values the
> users
> > put in them. For example:
> >
> > If sheet2!.cells(12,3) = "N" Then
> >
> > Sheet3!.cells(3,2) = "Sold Out"
> >
> > or
> >
> > If sheet2!.cells(12,3) = "Y" Then
> >
> > Sheet3!.Visible = False
> >
> > I'll keep searching for the answers to this question but if someone could
> > shoot me a quick answer I would appreciate it.
>
>
>
From: Jim Thomlinson on
That is an on demand macro that the user would have to run on their own. You
could use the On Change event from Sheet 2 if you needed it to be automatic.
--
HTH...

Jim Thomlinson


"hshayh0rn" wrote:

> Thanks for the reply... So, would the user have to run the macro manually or
> does excel know to run this on its own?
>
> "Bob Phillips" wrote:
>
> > Sub myMacro()
> > If Worksheet("Sheet2").cells(12,3) = "N" Then
> > Worksheet("Sheet3").cells(3,2) = "Sold Out"
> > ElseIf Worksheet("Sheet2").cells(12,3) = "Y" Then
> > Worksheet("Sheet3").Visible = False
> > End If
> > End Sub
> >
> > This would be an on-demand macro, stored in a standard code module.
> >
> > --
> >
> > HTH
> >
> > RP
> > (remove nothere from the email address if mailing direct)
> >
> >
> > "hshayh0rn" <hshayh0rn(a)discussions.microsoft.com> wrote in message
> > news:A01F93A5-C8A4-479D-AF14-E6A4DF0C0228(a)microsoft.com...
> > > I have a very basic question but I can't seem to find the answer on here
> > > (probably to basic). I have a spreadsheet that I would like to perform all
> > of
> > > my calculations / If / Then statements using VBA but I'm not sure how to
> > > actually get the code to run or where to put it to run... I can get all of
> > > the code to run with an on click event or something like that but
> > basically
> > > I'd like cells to automatically fill in other cells based on values the
> > users
> > > put in them. For example:
> > >
> > > If sheet2!.cells(12,3) = "N" Then
> > >
> > > Sheet3!.cells(3,2) = "Sold Out"
> > >
> > > or
> > >
> > > If sheet2!.cells(12,3) = "Y" Then
> > >
> > > Sheet3!.Visible = False
> > >
> > > I'll keep searching for the answers to this question but if someone could
> > > shoot me a quick answer I would appreciate it.
> >
> >
> >
From: hshayh0rn on
From the last time I posted I found the on change event and thought that
might be the answer but the code Bob supplied does not work when I add it to
the on change event.

"Jim Thomlinson" wrote:

> That is an on demand macro that the user would have to run on their own. You
> could use the On Change event from Sheet 2 if you needed it to be automatic.
> --
> HTH...
>
> Jim Thomlinson
>
>
> "hshayh0rn" wrote:
>
> > Thanks for the reply... So, would the user have to run the macro manually or
> > does excel know to run this on its own?
> >
> > "Bob Phillips" wrote:
> >
> > > Sub myMacro()
> > > If Worksheet("Sheet2").cells(12,3) = "N" Then
> > > Worksheet("Sheet3").cells(3,2) = "Sold Out"
> > > ElseIf Worksheet("Sheet2").cells(12,3) = "Y" Then
> > > Worksheet("Sheet3").Visible = False
> > > End If
> > > End Sub
> > >
> > > This would be an on-demand macro, stored in a standard code module.
> > >
> > > --
> > >
> > > HTH
> > >
> > > RP
> > > (remove nothere from the email address if mailing direct)
> > >
> > >
> > > "hshayh0rn" <hshayh0rn(a)discussions.microsoft.com> wrote in message
> > > news:A01F93A5-C8A4-479D-AF14-E6A4DF0C0228(a)microsoft.com...
> > > > I have a very basic question but I can't seem to find the answer on here
> > > > (probably to basic). I have a spreadsheet that I would like to perform all
> > > of
> > > > my calculations / If / Then statements using VBA but I'm not sure how to
> > > > actually get the code to run or where to put it to run... I can get all of
> > > > the code to run with an on click event or something like that but
> > > basically
> > > > I'd like cells to automatically fill in other cells based on values the
> > > users
> > > > put in them. For example:
> > > >
> > > > If sheet2!.cells(12,3) = "N" Then
> > > >
> > > > Sheet3!.cells(3,2) = "Sold Out"
> > > >
> > > > or
> > > >
> > > > If sheet2!.cells(12,3) = "Y" Then
> > > >
> > > > Sheet3!.Visible = False
> > > >
> > > > I'll keep searching for the answers to this question but if someone could
> > > > shoot me a quick answer I would appreciate it.
> > >
> > >
> > >