View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Luke M Luke M is offline
external usenet poster
 
Posts: 2,722
Default Creating a Simple macro

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").Value = "x" Then
Range("A2").Value = Range("A3").Value * 0.5
End If
End Sub

Note that you will need to paste this onto the correct sheet in VBA, NOT a
module.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Gunti" wrote:

Hi, Thanks alot. I have another question though, i want it to act exactly
like a normal Excel formula (monitor if A1="x" all the time)

"Luke M" wrote:

Sub YourMacroName()
If Range("A1").Value = "x" Then
Range("A2").Value = Range("A3").Value * 0.5
End If
End Sub

Just paste then into a module in the VBA editor, and you should be good.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Gunti" wrote:

Hi,
I want to create a very simple macro and i'm having trouble finding it on
the internet.

I basicly want the following formula:

If Range(a1) = "x" Then
Cell A2 = "Cell A3*0.5)

I am completely new to creating macro's (as you can see).
Any help is appreciated

Gunti