Hi,
How can i transfer the item selected in Listbox1 to the first empty cell in
Sheet1 Range("J14:J213") with Interior.Color = RGB(128, 128, 128).
The interior colour of cells in Range("J14:J213") are either white or grey depending
on whether the adjacent cell in I14:I213 has a value greater than 0.
Thanks again
Mohamed
ListBox Transfer depending upon Cell Interior Colour
-
- 3StarLounger
- Posts: 366
- Joined: 12 May 2010, 06:49
-
- Administrator
- Posts: 79317
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: ListBox Transfer depending upon Cell Interior Colour
You could use code like this, for example in the On Click event of a command button:
Code: Select all
Dim r As Long
For r = 14 To 213
With Range("J" & r)
If .Value = "" And .Interior.Color = RGB(128, 128, 128) Then
.Value = ListBox1.Value
Exit Sub
End If
End With
Next r
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 821
- Joined: 24 Jan 2010, 15:56
Re: ListBox Transfer depending upon Cell Interior Colour
If you are talking about Conditional Formatting, then you should test the value in the adjacent column, because the Interior.Colorindex will not reflect colours applied by CF. (if you are using 2010, you can refer to the DisplayFormat instead).MSingh wrote: The interior colour of cells in Range("J14:J213") are either white or grey depending
on whether the adjacent cell in I14:I213 has a value greater than 0.
Regards,
Rory
Rory
-
- 3StarLounger
- Posts: 366
- Joined: 12 May 2010, 06:49
Re: ListBox Transfer depending upon Cell Interior Colour
Hi Hans,
Thanks again-code worked perfectly!
Thank you Rory - I will heed your advice.
Kind Regards
Mohamed
Thanks again-code worked perfectly!
Thank you Rory - I will heed your advice.
Kind Regards
Mohamed