LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Apply formula to a range with multiple selections

I'm trying to apply a formula to a range that a user can select.
Basically I have a user form where the user can select a range of data
to be processed as well as an output cell where there the
converted/processed range is put.

Once the input ranges and output cell has been chosen I need to apply a
formula to every cell in the input range and put it in the output cell.

I have been successful in doing this where the input range is only a
single selection but have been unable to get it to work with more
multiple selections as the input range. Here is my code:

Dim r As Range
Dim r2 As Range

' Input and output ranges in userform
Set r = Range(refInput.Value)
Set r2 = Range(refOutput.Value)

r.Copy
r2.PasteSpecial Paste:=xlPasteValues

Selection.SpecialCells(xlConstants).Formula = "--- formula goes
here ---"

' Get rid of formulas so user does not see them.
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues

Any way to get my code to work with multiple selections.

 
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 get range names to Apply across multiple tabs TrippKnightly Excel Worksheet Functions 1 August 10th 11 03:48 PM
How do I apply a formula to multiple rows at the same time? ManhattanRebel Excel Worksheet Functions 1 November 22nd 07 03:28 PM
Apply autofilter selections to 2nd table automatically? Macro? bryan stewart Excel Worksheet Functions 1 January 30th 07 04:31 PM
Creating Multiple GIFs from Multiple Range selections -- I need a volunteer to test my code to see why it fails Father Guido[_5_] Excel Programming 0 November 19th 05 08:52 AM
apply a formula to multiple cells FixitFrog Excel Discussion (Misc queries) 3 June 23rd 05 11:54 AM


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