Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Input variables on Sheet1 being called by a VB program on Sheet 2

Tom provided me with some code that helps me hide rows in a sheet
based on a user input on that specific sheet. The code looks like
this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
if Target.count 1 then exit sub
if Target.Address = "$A$15" then
Rows(20).Resize(10).Hidden = True
if Target.Value =1 and Target.Value <= 5 then _
Rows(20).Resize(Target.Value*2).Hidden = False
End if
End Sub

I would like 2 variations on this code:
1. Where the user input is on a separate sheet
2. Where the 'hidden' statements are on a different sheet.

Example:
1. The active sheet is Sheet 2 and want the TargetAddress to be
from Sheet 1. (I assume this would be the 3rd line of code (if
Target.Address=$A$15)

2. I want the input (if Target.Address=$A$15) is the active sheet to
effect the Hidden (lines 5, 6, and 7) on a different Sheet.

I played around with something like:
if Target.Address =Sheet1$A$15 but I know that is incorrect. Any help
would be appreciated.

RU
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Input variables on Sheet1 being called by a VB program on Sheet 2

Hi

try this

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Address = "$A$15" Then
Sheet2.Rows(20).Resize(10).Hidden = True
If Target.Value = 1 And Target.Value <= 5 Then _
Sheet2.Rows(20).Resize(Target.Value * 2).Hidden = False
End If
End Sub

This is the new code

Sheet2.Rows(20).Resize(10).Hidden = True

Where sheet2 is the sheet you want to hide the row on
based on the input on sheet1, or where ever
the 'worksheet_change' macro resides.

Hope this helps

Richard Daniels
-----Original Message-----
Tom provided me with some code that helps me hide rows

in a sheet
based on a user input on that specific sheet. The code

looks like
this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
if Target.count 1 then exit sub
if Target.Address = "$A$15" then
Rows(20).Resize(10).Hidden = True
if Target.Value =1 and Target.Value <= 5 then _
Rows(20).Resize(Target.Value*2).Hidden = False
End if
End Sub

I would like 2 variations on this code:
1. Where the user input is on a separate sheet
2. Where the 'hidden' statements are on a different

sheet.

Example:
1. The active sheet is Sheet 2 and want the

TargetAddress to be
from Sheet 1. (I assume this would be the 3rd line of

code (if
Target.Address=$A$15)

2. I want the input (if Target.Address=$A$15) is the

active sheet to
effect the Hidden (lines 5, 6, and 7) on a different

Sheet.

I played around with something like:
if Target.Address =Sheet1$A$15 but I know that is

incorrect. Any help
would be appreciated.

RU
.

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 use two parameters in input of popup Variables - Gary's Student Colin Hayes Excel Worksheet Functions 0 February 2nd 10 11:03 PM
Array for varying 2 out of many input variables for complicated fx MontyCR Excel Discussion (Misc queries) 0 April 10th 09 07:13 PM
How can I have have one column's input depend on the variables in a second one? willb Excel Worksheet Functions 3 October 18th 06 12:31 PM
where can i get a software program called Microfit? xoliswa Excel Discussion (Misc queries) 2 August 9th 06 01:07 PM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


All times are GMT +1. The time now is 08:18 AM.

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"