Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default If blank, insert adjoining cell value

Hi All..........
Having a tough time here, I would like to scan column J of the activesheet
from unknown bottom up to and including Row 2 and if each cell is blank, to
insert the value in the adjoining cell in column I, (a date or also a
blank), and at the same time, color the background of that cell red. Any
help would be appreciated.

Vaya con Dios,
Chuck, CABGx3




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default If blank, insert adjoining cell value

Sub Test()
Dim myRange As Range
Dim r As Range
Dim lcol As Long
Dim lrow As Long


lcol = 10
lrow = Cells(Rows.Count, lcol).End(xlUp).Row
Set myRange = Cells(2, lcol)
Set myRange = Cells(2, lcol).Resize(lrow - 2 + 1, 1)
For Each r In myRange
If IsEmpty(r) Then
r.FillRight
r.Interior.ColorIndex = 3
End If
Next r

End Sub


"CLR" wrote:

Hi All..........
Having a tough time here, I would like to scan column J of the activesheet
from unknown bottom up to and including Row 2 and if each cell is blank, to
insert the value in the adjoining cell in column I, (a date or also a
blank), and at the same time, color the background of that cell red. Any
help would be appreciated.

Vaya con Dios,
Chuck, CABGx3





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default If blank, insert adjoining cell value

How about:

Sub clr()
For i = Cells(Rows.Count, "J").End(xlUp).Row To 2 Step -1
If IsEmpty(Cells(i, "J")) Then
Cells(i, "J").Value = Cells(i, "I").Value
Cells(i, "J").Interior.ColorIndex = 46
End If
Next
End Sub

--
Gary''s Student - gsnu200714


"CLR" wrote:

Hi All..........
Having a tough time here, I would like to scan column J of the activesheet
from unknown bottom up to and including Row 2 and if each cell is blank, to
insert the value in the adjoining cell in column I, (a date or also a
blank), and at the same time, color the background of that cell red. Any
help would be appreciated.

Vaya con Dios,
Chuck, CABGx3





  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default If blank, insert adjoining cell value

Thats cool Barb, thanks...........it works better than anything I got
now.......just one little quirk tho........if column I has data down further
than column J, it just ignores the bottom part of column J...........is
there an easy fix for that?

Vaya con Dios,
Chuck, CABGx3





"Barb Reinhardt" wrote in message
...
Sub Test()
Dim myRange As Range
Dim r As Range
Dim lcol As Long
Dim lrow As Long


lcol = 10
lrow = Cells(Rows.Count, lcol).End(xlUp).Row
Set myRange = Cells(2, lcol)
Set myRange = Cells(2, lcol).Resize(lrow - 2 + 1, 1)
For Each r In myRange
If IsEmpty(r) Then
r.FillRight
r.Interior.ColorIndex = 3
End If
Next r

End Sub


"CLR" wrote:

Hi All..........
Having a tough time here, I would like to scan column J of the

activesheet
from unknown bottom up to and including Row 2 and if each cell is blank,

to
insert the value in the adjoining cell in column I, (a date or also a
blank), and at the same time, color the background of that cell red.

Any
help would be appreciated.

Vaya con Dios,
Chuck, CABGx3







  #5   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default If blank, insert adjoining cell value

Cool Gary"s Student, thank you, but it also has the same problem as Barb's,
in that it ignores the bottom of column J if column I is longer than column
J

I somehow need the row count to be figured from the longer of I or
J..........possible?

Oooops, never mind, I can use column A........it's always equal to the
longest.......

THANKS A BUNCH TO BOTH YOU AND BARB..........

Vaya con Dios,
Chuck, CABGx3


"Gary''s Student" wrote in message
...
How about:

Sub clr()
For i = Cells(Rows.Count, "J").End(xlUp).Row To 2 Step -1
If IsEmpty(Cells(i, "J")) Then
Cells(i, "J").Value = Cells(i, "I").Value
Cells(i, "J").Interior.ColorIndex = 46
End If
Next
End Sub

--
Gary''s Student - gsnu200714


"CLR" wrote:

Hi All..........
Having a tough time here, I would like to scan column J of the

activesheet
from unknown bottom up to and including Row 2 and if each cell is blank,

to
insert the value in the adjoining cell in column I, (a date or also a
blank), and at the same time, color the background of that cell red.

Any
help would be appreciated.

Vaya con Dios,
Chuck, CABGx3







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
Stop spilling the text to the adjoining cell F.G. Excel Discussion (Misc queries) 7 May 14th 08 09:03 PM
insert rows in a worksheet that do not change adjoining rows craigandmel Excel Discussion (Misc queries) 2 April 29th 08 10:26 PM
if cell is blank insert a zero JK Excel Discussion (Misc queries) 3 October 24th 07 03:09 PM
automatically date a cell when entering data in adjoining cell John Imm Excel Programming 1 October 9th 06 02:53 PM
How do I display contents of an adjoining cell? Sue Smith Excel Worksheet Functions 3 September 24th 05 05:07 AM


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