Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Reference a specific cell in the active row

I am trying to write a code that will generate a comment box if the user
enters a value not equal to the value I set. All my values are entered in
column B. How do I need to word the code so that if the active cell is
anywhere on row 4, the cell value is compared to B4, If the active cell is
M27 then its value is compared to B27, etc.

This is the portion of the code I am talking about.

If Target < WHAT DO I PUT HERE??? Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Reference a specific cell in the active row

I may not have a solution but I have a question...

<... if the active cell is anywhere on row 4, the cell value is compared to
B4, If the active cell is M27 then its value is compared to B27, etc.

If the activecell is anywhere in row 4 you want to campare to the value in
B4. And if the activecell is M27 you want to compare to B27?

Why the... etc.?

Did you mean activecell anywhere in row 27 compared to B27?

HTH
Regards,
Howard

"dweber1188" wrote in message
...
I am trying to write a code that will generate a comment box if the user
enters a value not equal to the value I set. All my values are entered in
column B. How do I need to word the code so that if the active cell is
anywhere on row 4, the cell value is compared to B4, If the active cell is
M27 then its value is compared to B27, etc.

This is the portion of the code I am talking about.

If Target < WHAT DO I PUT HERE??? Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Reference a specific cell in the active row

That is correct, any cell in a given row should compare its value to column B
of that row.

"L. Howard Kittle" wrote:

I may not have a solution but I have a question...

<... if the active cell is anywhere on row 4, the cell value is compared to
B4, If the active cell is M27 then its value is compared to B27, etc.

If the activecell is anywhere in row 4 you want to campare to the value in
B4. And if the activecell is M27 you want to compare to B27?

Why the... etc.?

Did you mean activecell anywhere in row 27 compared to B27?

HTH
Regards,
Howard

"dweber1188" wrote in message
...
I am trying to write a code that will generate a comment box if the user
enters a value not equal to the value I set. All my values are entered in
column B. How do I need to word the code so that if the active cell is
anywhere on row 4, the cell value is compared to B4, If the active cell is
M27 then its value is compared to B27, etc.

This is the portion of the code I am talking about.

If Target < WHAT DO I PUT HERE??? Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Reference a specific cell in the active row

Try it this way...

If Target.Value < Cells(Target.Row, "B").Value Then

--
Rick (MVP - Excel)


"dweber1188" wrote in message
...
I am trying to write a code that will generate a comment box if the user
enters a value not equal to the value I set. All my values are entered in
column B. How do I need to word the code so that if the active cell is
anywhere on row 4, the cell value is compared to B4, If the active cell is
M27 then its value is compared to B27, etc.

This is the portion of the code I am talking about.

If Target < WHAT DO I PUT HERE??? Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Reference a specific cell in the active row

Thank you Rick.

This has got it just about where I want it. The only issue I am having now
is, even though it generates a comment, the comment box never appears, the
triangle just shows up in the corner of the cell but does not give the user a
chance to type anything.

I don't want the comments to always remain visible, that would just create
too much clutter. I am trying to get it to appear so the user can enter
comments and then disappear when they move to the next cell.

"Rick Rothstein" wrote:

Try it this way...

If Target.Value < Cells(Target.Row, "B").Value Then

--
Rick (MVP - Excel)


"dweber1188" wrote in message
...
I am trying to write a code that will generate a comment box if the user
enters a value not equal to the value I set. All my values are entered in
column B. How do I need to word the code so that if the active cell is
anywhere on row 4, the cell value is compared to B4, If the active cell is
M27 then its value is compared to B27, etc.

This is the portion of the code I am talking about.

If Target < WHAT DO I PUT HERE??? Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Reference a specific cell in the active row

Try the following. (I have assumed that it is in a worksheet change event.)

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Value < Cells(Target.Row, "B").Value Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If

End Sub

--
Regards,

OssieMac


"dweber1188" wrote:

I am trying to write a code that will generate a comment box if the user
enters a value not equal to the value I set. All my values are entered in
column B. How do I need to word the code so that if the active cell is
anywhere on row 4, the cell value is compared to B4, If the active cell is
M27 then its value is compared to B27, etc.

This is the portion of the code I am talking about.

If Target < WHAT DO I PUT HERE??? Then
With Target
.AddComment
.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
End With
End If

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Reference a specific cell in the active row

I had an afterthought on this and wondered if you might appreciate a little
more information if you need to delete the comment or edit the info in an
existing comment. (You can't add a comment if one already exists.)

Private Sub Worksheet_Change(ByVal Target As Range)

With Target

If .Value < Cells(Target.Row, "B").Value Then
If .Comment Is Nothing Then
.AddComment
End If

.Comment.Text Text:=Application.UserName & ":" & Chr(10)
.Comment.Visible = True
Else
If Not .Comment Is Nothing Then
.Comment.Delete
End If
End If

End With

End Sub

--
Regards,

OssieMac


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
Active row cell reference pskwaak Excel Worksheet Functions 2 March 18th 07 01:38 AM
Active Cell Reference pskwaak Excel Worksheet Functions 8 March 13th 07 02:22 AM
Select specific cells in same row as active cell michaelberrier Excel Programming 4 January 25th 07 08:04 PM
Select specific cells in same row as active cell michaelberrier Excel Programming 1 January 25th 07 07:26 PM
Active cell is within a specific range Todd Huttenstine Excel Programming 1 November 1st 04 04:57 PM


All times are GMT +1. The time now is 04:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"