Thread: Challenging
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] lovepeaceofmind@yahoo.com is offline
external usenet poster
 
Posts: 29
Default Challenging

On May 18, 9:52 am, JLGWhiz wrote:
Probably would not get any if Range(i, 6) was changed to Cells(i, 6). The
code from a previous post produced several error messages. Most were caused
by trying to use code in a Worksheet_SelectionChange that was structured for
standard module application and not for passing by val to Target as Range.
The full code would not execute.



"NickHK" wrote:
You keep posting the same question without making much progress on any of
them.
If it is a problem with seeing your posts/replies, do not use Google but a
"real" newsreader; Outlook Express, Agent etc.


Anyway, which error do you get with the code below ?
Hint: Add a debug.print i


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer


Range(i, 6).Value = 0
End Sub


Also, check the help for Offset and Intersect.


NickHK


wrote in message
roups.com...
Hi,


I have two columns, say column C and D with unlimited rows. The text
or quantity starts in each row either from column C or Column D, but
not both. I will need to highlight the starting cell with green by
manually fill it with green to indicate that I need this row. Here is
an example:


If I highlight C23 as green, I would like to return a value of 1 in
cell F23,
If I highlight C25 as green, I would like to return a value of 1 in
cell F25,
If I highlight D28 as green, I would like to return a value of 1 in
cell F28, etc.


Anyway, any cell under column F must be 1 or 0 depending on the cell
color under Column C OR Column D (not both) in the SAME ROW. Please
note that I can randomly add some new rows in the middle of the
worksheet. Those new rows will follow the same rules. This means that
there is no fixed number of rows.


Any help will be highly appreciated! The following code is for your
reference!


Thanks,
Jorge


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer


Range(i, 6).Value = 0
For i = 1 To Rows.Count
If Cells(i, 3).Interior.ColorIndex = 10 Then
Range(i, 6).Value = 1
Else
If Cells(i, 4).Interior.ColorIndex = 10 Then
Range(i, 6).Value = 1


Exit Sub
End If
End If
Next i
End Sub- Hide quoted text -


- Show quoted text -


Thank you so much for your input!

Even I changed the code from Private Sub
Worksheet_SelectionChange(ByVal Target As Range)

to

Private Sub Worksheet_Change(ByVal Target As Range)

It is still not working.

Please advise!

Thanks again!