View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Colin Hayes Colin Hayes is offline
external usenet poster
 
Posts: 465
Default Making code less column-specific

HI Don

OK Thanks for that.

I do use the recorder sometimes , but it always makes code column or
cell-specific. This is the case also in your example below. It was
specifically to avoid this that I posted my query.

I was just wondering if the code you sent before could be modified to
accommodate Multiplication and Division , and then be applied to the
highlighted column , whichever it may be.

Anyway , very grateful for your expert help. Much appreciated.



Best Wishes


Colin





In article , Don Guillett
writes
Please post at the TOP when responding to me. Most prefer that way.
I just recorded this to show you how the recorder can be your friend.
Easy enough to put in an input box asking for the desired function.

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 1/24/2009 by Donald B. Guillett
'

'
Range("B7").Select
Selection.Copy
Range("G3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Range("G4").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide,
SkipBlanks _
:=False, Transpose:=False
Range("G5").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlSubtract, _
SkipBlanks:=False, Transpose:=False
Range("G6").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd, SkipBlanks:=
_
False, Transpose:=False
End Sub