Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ilvmgicker
 
Posts: n/a
Default Help Please, Worksheet Change

Sorry for cross post. This group seems to have more activity. Anyway....



Forget the values I have used in the simple example, they are there just to
show you what I need to work.

Using the code...
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G1")) Is Nothing Then

If Range("G1").Value = Range("B3").Value Then
Range("A3").Value = Range("A1").Value
Range("C3").Value = Range("C1").Value
Range("E3:F3").Value = Range("E1:F3").Value

End If
End If
End Sub

If I enter ton in G1 the values in the cells change.


Before Worksheet Change

A B C D E F G
1 gun pig cat pen too hit
2
3 ton

I enter ton in cell G1

After Worksheet Change

A B C D E F G
1 gun pig cat pen too hit ton
2
3 gun ton cat too hit


With me? This works fine for a small project, but I have many values to
check.
Suppose Range A1:G35 (change If Not Intersect(Target, Range("G1:G35")) Is
Nothing Then) holds all the data I need to 'copy' if there is a match and
Range A71:F105 is where those 'copied' values are placed.
One problem is the code gets very long, repetitive and finally the code gets
too big for EXcel and it won't run.

Is there anyway I can shorten the code? Got an idea it has something to do
with variables but I am new to VBA and am getting really lost.

Thanks in advance





At present I need to check 18 cell values against 23 cell values, this will
increase shortly.




  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Help Please, Worksheet Change

Does it all get copied in a block, or in parts as in the original example?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ilvmgicker" wrote in message
y.net...
Sorry for cross post. This group seems to have more activity. Anyway....



Forget the values I have used in the simple example, they are there just

to
show you what I need to work.

Using the code...
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G1")) Is Nothing Then

If Range("G1").Value = Range("B3").Value Then
Range("A3").Value = Range("A1").Value
Range("C3").Value = Range("C1").Value
Range("E3:F3").Value = Range("E1:F3").Value

End If
End If
End Sub

If I enter ton in G1 the values in the cells change.


Before Worksheet Change

A B C D E F G
1 gun pig cat pen too hit
2
3 ton

I enter ton in cell G1

After Worksheet Change

A B C D E F G
1 gun pig cat pen too hit ton
2
3 gun ton cat too hit


With me? This works fine for a small project, but I have many values to
check.
Suppose Range A1:G35 (change If Not Intersect(Target, Range("G1:G35")) Is
Nothing Then) holds all the data I need to 'copy' if there is a match and
Range A71:F105 is where those 'copied' values are placed.
One problem is the code gets very long, repetitive and finally the code

gets
too big for EXcel and it won't run.

Is there anyway I can shorten the code? Got an idea it has something to do
with variables but I am new to VBA and am getting really lost.

Thanks in advance





At present I need to check 18 cell values against 23 cell values, this

will
increase shortly.






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 change number to text in new column from another worksheet? Lynn Excel Worksheet Functions 3 November 16th 05 12:45 PM
Change complete worksheet to degrees Scrungie Excel Discussion (Misc queries) 2 September 12th 05 06:59 PM
Comparing a list to a Calendar worksheet. PatrickL Excel Worksheet Functions 0 August 25th 05 04:21 PM
worksheet columns changed from letter to number, how change back Ron New Users to Excel 2 May 9th 05 08:35 PM
change worksheet size beefyme Excel Discussion (Misc queries) 1 January 20th 05 08:13 PM


All times are GMT +1. The time now is 03:44 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"