Results 1 to 4 of 4

Performing an action on a selection (ActiveCell?)

Threaded View

  1. #1
    Registered User
    Join Date
    08-10-2009
    Location
    Finland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Performing an action on a selection (ActiveCell?)

    Hello everyone,

    I'm a bit of a beginner in excel macros and I have a small problem. I would like to perform an action (multiply by (-1) to get opposite numbers) on an "active selection".

    Its easy to make a macro to do this on a single active cell:
    ActiveCell.Value = ActiveCell.Value * (-1)

    ....But what I want to do is perform this same action on all the cells I have selected. Is there some function to do this? I have tried searching around the board and on the internet but havent found anything to help me out with this specific thing.

    I have attached a picture to show what im trying to do. The macro I have written only does the action on the 1st cell instead of all the selected ones.

    What I have atm is:

    Sub Opposite()
    
    ActiveCell.Value = ActiveCell.Value * (-1)
    
    End Sub

    Thanks in advance,
    Glooms
    Attached Images Attached Images
    Last edited by dominicb; 08-10-2009 at 03:46 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1