Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Creating a Simple macro

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Creating a Simple macro

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Creating a Simple macro

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Creating a Simple macro

Hi Gunti
I know your asking for a macro but a simple formula will do the same
=IF(A1="x",A3*0.5,"") if no"x" show nothing.
HTH
John
"Gunti" wrote in message
...
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


  #5   Report Post  
Posted to microsoft.public.excel.misc
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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Creating a Simple macro

I know this, the reason i'm asking such a simple question is because i now
can modify the formula given to my needs (I don't want the formula part in
excel to be filled).

Grtz & Thanks,
Gunti

"John" wrote:

Hi Gunti
I know your asking for a macro but a simple formula will do the same
=IF(A1="x",A3*0.5,"") if no"x" show nothing.
HTH
John
"Gunti" wrote in message
...
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



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Creating a Simple macro

Hey, thanks alot! Almost exactly what i need. Now i need one last thing, how
do i use this for multiple cells. Do i add a new Private Sub?

Thanks a lot!

"Luke M" wrote:

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

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Creating a Simple macro

Another question, this works. It however waits for me to click somewhere in
the sheet before it changes my cell. Any way to avoid this?

Greets,
Gunti

"Luke M" wrote:

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

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Creating a Simple macro

Wow @ replying 3 times. I'm sorry.

I however found it necessary that i'm using the following formula:

If Range("D32").Value = "All-in 10%" Then
Range("D33").Value = Range("N5").Value

Another quick one while i'm at it:
I want it to become empty when it is not "All-in 10%".

If Range("D32").Value = "All-in 10%" Then
Range("D33").Value = Range("N5").Value
Then
Range("D33").Value = ??????

What must i use for it to become empty??

"Gunti" wrote:

Another question, this works. It however waits for me to click somewhere in
the sheet before it changes my cell. Any way to avoid this?

Greets,
Gunti

"Luke M" wrote:

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

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
Creating a simple chart Keith Charts and Charting in Excel 1 September 1st 08 05:43 PM
Creating a Simple Bar Chart - 2 Areas for help please BRob Charts and Charting in Excel 4 May 18th 08 02:42 AM
Creating what should be a simple macro Dwight Excel Discussion (Misc queries) 6 April 13th 07 06:38 PM
Creating a very simple spreadsheet for my diet Tim Excel Discussion (Misc queries) 3 October 18th 06 12:43 PM
I'm creating a simple spread sheet Jan in Excel Excel Discussion (Misc queries) 2 January 2nd 06 07:48 PM


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