#1   Report Post  
Posted to microsoft.public.excel.misc
Donna S
 
Posts: n/a
Default macro if statements

I'm trying to write a simple if statement that looks at an active cell and
compares is to the data in another cell. So far I have:

If Selection.Value = ??????? Then

Please help me fill in the ???????. This is probably very simple but I'm
just learning.

Thanks,
  #3   Report Post  
Posted to microsoft.public.excel.misc
Miguel Zapico
 
Posts: n/a
Default macro if statements

This is one option:
If Selection.Value = ActiveSheet.Range("A1").Value Then
It compares the value on the selected cell with the range A1 of the same
worksheet.

Hope this helps,
Miguel.

"Donna S" wrote:

I'm trying to write a simple if statement that looks at an active cell and
compares is to the data in another cell. So far I have:

If Selection.Value = ??????? Then

Please help me fill in the ???????. This is probably very simple but I'm
just learning.

Thanks,

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default macro if statements

If activecell.value = worksheets("sheet99999").range("a99").value then

Remember that if you're comparing text, ABC < aBc and ABC < abc (and so
forth).

If lcase(activecell.value) _
= lcase(worksheets("sheet99999").range("a99").value) then

is one way around it if you want to ignore case.

Selection can be multiple cells. Activecell will be one cell.


Donna S wrote:

I'm trying to write a simple if statement that looks at an active cell and
compares is to the data in another cell. So far I have:

If Selection.Value = ??????? Then

Please help me fill in the ???????. This is probably very simple but I'm
just learning.

Thanks,


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default macro if statements

How do I ask: if selection.value = the value in the cell offset (0,-4)??????

"Miguel Zapico" wrote:

This is one option:
If Selection.Value = ActiveSheet.Range("A1").Value Then
It compares the value on the selected cell with the range A1 of the same
worksheet.

Hope this helps,
Miguel.

"Donna S" wrote:

I'm trying to write a simple if statement that looks at an active cell and
compares is to the data in another cell. So far I have:

If Selection.Value = ??????? Then

Please help me fill in the ???????. This is probably very simple but I'm
just learning.

Thanks,

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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


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