PC Review


Reply
Thread Tools Rate Thread

How do I sort worksheet without affecting formula values?

 
 
HELP PLEASE!
Guest
Posts: n/a
 
      13th Mar 2010
I have two worksheets, one of which has formulas which reference the other.
The problem is, I cannot sort the first worksheet and have the formula values
in the second worksheet follow it so the values stay the same. I have tried
making them absolute references ($A$1) but it doesn't help.
 
Reply With Quote
 
 
 
 
Dennis Tucker
Guest
Posts: n/a
 
      14th Mar 2010
I feel your pain. I've ran into the same issue before.

The problem is the use of worksheet functions. The solution is DO NOT USE
worksheet functions. Use a VBA subroutine instead.

Here is an example:

With worksheet functions....

A B C
1 2 3 6(formula =A1*B1)
2 4 5 20(formula =A2*B2)
3 6 7 42(formula =A3*B3)
..
..

Without worksheet functions, using VBA Sub....

A B C (Start
Button)
1 2 3
2 4 5 User clicks
the start button and the macro runs.
3 6 7

A B C (Start
Button)
1 2 3 6
2 4 5 20
3 6 7 42

The Macro Code

Sub MultiplyMyNumbers()

For MyRow=1 to 3

Worksheets("Sheet1").Range("C"+Cstr(MyRow)).Value =
Worksheets(("Sheet1").Range("A"+Cstr(MyRow)).Value *
Worksheets(("Sheet1").Range("B"+Cstr(MyRow)).Value

Next MyRow

End Sub





"HELP PLEASE!" <HELP PLEASE!@discussions.microsoft.com> wrote in message
news:CF8032D2-204E-4F0C-ACF7-(E-Mail Removed)...
> I have two worksheets, one of which has formulas which reference the
> other.
> The problem is, I cannot sort the first worksheet and have the formula
> values
> in the second worksheet follow it so the values stay the same. I have
> tried
> making them absolute references ($A$1) but it doesn't help.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace worksheet without affecting the referencing formula Jay Microsoft Excel Misc 1 7th May 2009 03:11 AM
Can't get Top Values to sort a formula JimAA Microsoft Access Queries 2 9th Oct 2008 01:15 PM
Sort worksheet tabs based on ASCII values. BVinson Microsoft Excel Programming 7 20th Dec 2007 08:49 PM
How can I sort data without affecting formula? =?Utf-8?B?dmlja2lz?= Microsoft Excel Misc 3 10th Jan 2007 03:57 AM
sort worksheet without affecting workbook =?Utf-8?B?QmFycnk=?= Microsoft Excel Worksheet Functions 3 2nd Nov 2005 10:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:47 PM.