Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
daidipya
 
Posts: n/a
Default assign macro to a lise

i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the said
macro should run. Please help me out

  #2   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default assign macro to a lise

Hi

One way would be to add the following event code to the Sheet1 module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the said
macro should run. Please help me out



  #3   Report Post  
Posted to microsoft.public.excel.misc
daidipya
 
Posts: n/a
Default assign macro to a lise

Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your help i
am now able to hide any rows in any sheets by modifying the code.

can you also help me with this
--- Now i want to run different macros depending upon the different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1 module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the said
macro should run. Please help me out


  #4   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default assign macro to a lise

Hi

Just change the code to
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then Macro1
If Target.Value = "NO" Then Macro2
End Sub


--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your help
i
am now able to hide any rows in any sheets by modifying the code.

can you also help me with this
--- Now i want to run different macros depending upon the different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1 module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the
said
macro should run. Please help me out




  #5   Report Post  
Posted to microsoft.public.excel.misc
daidipya
 
Posts: n/a
Default assign macro to a lise

Thanks Roger Govier

can you help me for this:

i want to print the name of the sheet as footer for all the excel files
that i will work. i dont want to manually put the same comand evrytime
and in every sheet.

somebody had asked me to do teh following but the same is not working.

put &[tab] in to your footer will display the sheet name
&[file] will display the book name.
If you want this to be in every file you use, then open a blank
worksheet set up your custom footer and save it as a template
file called book1. Put it in the xlstart folder.

At present i am having windows XP and Office 2003

regards

daidipya


Roger Govier wrote:
Hi

Just change the code to
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then Macro1
If Target.Value = "NO" Then Macro2
End Sub


--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your help
i
am now able to hide any rows in any sheets by modifying the code.

can you also help me with this
--- Now i want to run different macros depending upon the different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1 module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the
said
macro should run. Please help me out





  #6   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default assign macro to a lise

Hi

I also have Windows XP and Office 2003 and it works fine for me
FilePage SetupHeader/FooterCustom Footer&[File] , &[Tab]

produces Book1 , Sheet1 at the foot of the printout, which will
naturally change as you rename the File and/or the tab.

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
Thanks Roger Govier

can you help me for this:

i want to print the name of the sheet as footer for all the excel
files
that i will work. i dont want to manually put the same comand evrytime
and in every sheet.

somebody had asked me to do teh following but the same is not working.

put &[tab] in to your footer will display the sheet name
&[file] will display the book name.
If you want this to be in every file you use, then open a blank
worksheet set up your custom footer and save it as a template
file called book1. Put it in the xlstart folder.

At present i am having windows XP and Office 2003

regards

daidipya


Roger Govier wrote:
Hi

Just change the code to
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then Macro1
If Target.Value = "NO" Then Macro2
End Sub


--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your
help
i
am now able to hide any rows in any sheets by modifying the code.

can you also help me with this
--- Now i want to run different macros depending upon the different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1
module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the
said
macro should run. Please help me out





  #7   Report Post  
Posted to microsoft.public.excel.misc
daidipya
 
Posts: n/a
Default assign macro to a lise

Hi

the same works only for the file in which we put the command, i am
looking for a command wherein the sheetname should get printed
automatically without requiring to put the command

Further to my ealrier query regarding the macros

the 1st code that you gave me is working fine. teh code you gave me was
as follows:

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B10").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B10").Select
End If
End Sub
<the said code i have copy pasted at modole 1

another code

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then HideRows
If Target.Value = "NO" Then HideRows
End Sub
<the same i have copy pasted at sheet1 (sheet1 )

Now i have modified the 1 st code as follows
Sub HideRowsddk()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("D65")
If Rng.Value = "Y" Then
Rows("66:70").EntireRow.Hidden = False
Range("D65").Select
ElseIf Rng.Value = "N" Then
Rows("66:70").EntireRow.Hidden = True
Range("D65").Select
End If
End Sub

to run the macro i have changed the 2nd code as follows

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 65 Then Exit Sub
If Target.Column < 4 Then Exit Sub
If Target.Value = "Y" Then HideRowsddk
If Target.Value = "N" Then HideRowsddk
End Sub

the same i have pasted at sheet 1(sheet 1) below the arlier code but
the macro is not running automatically, instead after chossing Y or N i
have to go to Tolls Macro. Hideddk and then run

how to get the second macro run automatically as well

regards

daidipya


Roger Govier wrote:
Hi

I also have Windows XP and Office 2003 and it works fine for me
FilePage SetupHeader/FooterCustom Footer&[File] , &[Tab]

produces Book1 , Sheet1 at the foot of the printout, which will
naturally change as you rename the File and/or the tab.

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
Thanks Roger Govier

can you help me for this:

i want to print the name of the sheet as footer for all the excel
files
that i will work. i dont want to manually put the same comand evrytime
and in every sheet.

somebody had asked me to do teh following but the same is not working.

put &[tab] in to your footer will display the sheet name
&[file] will display the book name.
If you want this to be in every file you use, then open a blank
worksheet set up your custom footer and save it as a template
file called book1. Put it in the xlstart folder.

At present i am having windows XP and Office 2003

regards

daidipya


Roger Govier wrote:
Hi

Just change the code to
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then Macro1
If Target.Value = "NO" Then Macro2
End Sub


--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your
help
i
am now able to hide any rows in any sheets by modifying the code.

can you also help me with this
--- Now i want to run different macros depending upon the different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1
module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the
said
macro should run. Please help me out




  #8   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default assign macro to a lise

Hi

You cannot have 2 Worksheet Change events in he same sheet. You need to
combine the 2 sets of code into one macro something like

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 OR Target.Row < 65 Then Exit Sub
If Target.Column < 2 OR Target.Column < 4 Then Exit Sub
If Target.Value = "YES" OR Target.Value = "NO" Then HideRows
If Target.Value = "Y" OR Target.Value = "N" Then HideRowsddk

End Sub

With regard to printing footers, then as was suggested to you earlier in
the thread
If you want this to be in every file you use, then open a blank
worksheet set up your custom footer and save it as a template
file called book1. Put it in the xlstart folder.


Having craeted the new file with the footer information set up, you need
to choose
FileSave AsFilename Book1 Filetype Template(*.xlt)
This file Book1.xlt needs to be stored in your startup directory

--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi

the same works only for the file in which we put the command, i am
looking for a command wherein the sheetname should get printed
automatically without requiring to put the command

Further to my ealrier query regarding the macros

the 1st code that you gave me is working fine. teh code you gave me
was
as follows:

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B10").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B10").Select
End If
End Sub
<the said code i have copy pasted at modole 1

another code

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then HideRows
If Target.Value = "NO" Then HideRows
End Sub
<the same i have copy pasted at sheet1 (sheet1 )

Now i have modified the 1 st code as follows
Sub HideRowsddk()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("D65")
If Rng.Value = "Y" Then
Rows("66:70").EntireRow.Hidden = False
Range("D65").Select
ElseIf Rng.Value = "N" Then
Rows("66:70").EntireRow.Hidden = True
Range("D65").Select
End If
End Sub

to run the macro i have changed the 2nd code as follows

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 65 Then Exit Sub
If Target.Column < 4 Then Exit Sub
If Target.Value = "Y" Then HideRowsddk
If Target.Value = "N" Then HideRowsddk
End Sub

the same i have pasted at sheet 1(sheet 1) below the arlier code but
the macro is not running automatically, instead after chossing Y or N
i
have to go to Tolls Macro. Hideddk and then run

how to get the second macro run automatically as well

regards

daidipya


Roger Govier wrote:
Hi

I also have Windows XP and Office 2003 and it works fine for me
FilePage SetupHeader/FooterCustom Footer&[File] , &[Tab]

produces Book1 , Sheet1 at the foot of the printout, which will
naturally change as you rename the File and/or the tab.

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
Thanks Roger Govier

can you help me for this:

i want to print the name of the sheet as footer for all the excel
files
that i will work. i dont want to manually put the same comand
evrytime
and in every sheet.

somebody had asked me to do teh following but the same is not
working.

put &[tab] in to your footer will display the sheet name
&[file] will display the book name.
If you want this to be in every file you use, then open a blank
worksheet set up your custom footer and save it as a template
file called book1. Put it in the xlstart folder.

At present i am having windows XP and Office 2003

regards

daidipya


Roger Govier wrote:
Hi

Just change the code to
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then Macro1
If Target.Value = "NO" Then Macro2
End Sub


--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your
help
i
am now able to hide any rows in any sheets by modifying the
code.

can you also help me with this
--- Now i want to run different macros depending upon the
different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1
module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10
the
said
macro should run. Please help me out






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a command button, then assign macro to it in excel kshaheen Excel Discussion (Misc queries) 3 June 24th 08 01:03 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
assign macro PH NEWS Excel Worksheet Functions 2 February 28th 06 02:17 PM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"