Pasteing values with conditions

  • Thread starter Thread starter brownti via OfficeKB.com
  • Start date Start date
B

brownti via OfficeKB.com

I have a sheet that is setup as follows: Range links1 has some links in it,
not all of the rows have links, but a majority of them do. The cells with
links in them are colored red, other cells are filled with a couple other
colors. i need some code that will find a cell that is red in that range,
check if there is a value in it, and if there is a value and the cell is red,
copy that value and paste that value one cell to the right. I know there is
a way to do this, but i am not sure how to get the code going. I would
really appreciate any help as this will really speed up a process. Thanks
 
for each cell in range("links")
if cell.interior.colorIndex = 3 then
if cell.HasFormula then
cell.offset(0,1).Value = cell.value
end if
end if
next

it isn't clear what you are looking for when you say value - is value
synonymous with number? then instead of hasformula do

if isnumeric(cell.value) then
cell.offset(0,1).Value = cell.value
 
There are different shades of red, so 3 may not be the right number

Sub getcolor()

mycolor = ActiveCell.Interior.ColorIndex

MsgBox ("Active Cell Color = " & CStr(mycolor))

End Sub
 
I knew it would be something pretty simple, thanks.

Tom said:
for each cell in range("links")
if cell.interior.colorIndex = 3 then
if cell.HasFormula then
cell.offset(0,1).Value = cell.value
end if
end if
next

it isn't clear what you are looking for when you say value - is value
synonymous with number? then instead of hasformula do

if isnumeric(cell.value) then
cell.offset(0,1).Value = cell.value
I have a sheet that is setup as follows: Range links1 has some links in it,
not all of the rows have links, but a majority of them do. The cells with
[quoted text clipped - 4 lines]
a way to do this, but i am not sure how to get the code going. I would
really appreciate any help as this will really speed up a process. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top