Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Applying change to selected cells


Hi All

Don Guillett kindly made some code to change the content of a column of
numbers :


Sub Add_Subtract_Multiply_Divide_Selected_Column()
'
Selection.NumberFormat = "0.00"
Dim mc, lr As Long
Dim row1value, dowhat, x As String
mc = ActiveCell.Column
lr = Cells(Rows.Count, mc).End(xlUp).Row
If lr = 1 Then Exit Sub
dowhat = InputBox("A to Add, D to Divide, M to Multiply, S to Subtract")
Select Case UCase(dowhat)
Case "A": x = xlAdd
Case "D": x = xlDivide
Case "M": x = xlMultiply
Case "S": x = xlSubtract
Case Else
MsgBox "Not a choice - Please Try Again."
Exit Sub
End Select
row1value = Cells(1, mc)
Cells(1, mc) = InputBox("Vary Number By How Much?")
Cells(1, mc).Copy
Range(Cells(2, mc), Cells(lr, mc)).PasteSpecial _
Paste:=xlPasteAll, Operation:=x
Application.CutCopyMode = False
Cells(1, mc) = row1value

End Sub


I need a modification of this so that it applies itself just to the
range of cells I select within the column , rather than to the whole
column.

Can someone help with this?


Any advice appreciated.



Best Wishes

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Applying change to selected cells

In article , Don Guillett
writes

Select for the copy or the destination?


Hi Don

Thanks for getting back again. I hope I understand your question
correctly.

I'd like to be able to highlight a group of cells in the same column ,
and have the macro apply only to the selected cells , rather than the
whole column , if possible.

The macro could simply overwrite the highlighted cells with the new
value , please.



Best Wishes
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Applying change to selected cells

In article , Don Guillett
writes
Still not entirely clear as to your desires. Try this:
Instead of
Range(Cells(2, mc), Cells(lr, mc)).PasteSpecial Paste:=xlPasteAll,
Operation:=x

try
selection.PasteSpecial Paste:=xlPasteAll, Operation:=x


Hi Don

OK that's got it working fine.

It now only operates on the selected cell range , rather than the whole
column , which is perfect.

Thanks again for you time and expertise.



Best Wishes
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
applying formulas for all sheets selected emilr17 Excel Worksheet Functions 3 July 16th 08 06:46 PM
How do i change the color of the selected cells? prash Excel Discussion (Misc queries) 0 August 27th 07 07:44 PM
how do i change the selected cells color Asofio New Users to Excel 1 March 7th 07 12:06 AM
Applying conditional formating to make cells change color [email protected] Excel Discussion (Misc queries) 1 March 6th 07 10:51 PM
How do I lock selected cells, so only I can change them? Robert Excel Worksheet Functions 3 February 27th 06 04:41 PM


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