Revisited: If Cell in row has data then do this: HELP

  • Thread starter Thread starter Yogi_Bear_79
  • Start date Start date
Y

Yogi_Bear_79

Code doesn't seemto be working;
At first I thought it was working, then I noticed all it was doing was
clearing the contents of the cells in column I

When I comment out these two lines nothing happens at all:

cells(rng.row,"G").Value = cell
cell.Clearcontents

Now I fI understood the code corrctly, editing out those two lines should
still allow F&G to concatanate. Which they are currently not


Actually,

I've found that it does work sort of:
It concatanates only F1&G1. Funny thing is it does it for as many cells in
column I that do have data so as an example:

F1 = Hello
G1 = World

Column I has 4 cells that contain data
nowF1 = Hello World World World World
 
H

Try this. If the range F1:F4 has a,b,c,d and G1:G4 has e,f,g,h and I1:I4 is 1,2,3,4 the output will b
F1:F4 ae, bf, cg, dh and G1:G4 1,2,3,4 and I1:I4 blank

Ton
Sub bbb(
Dim rng As Range, cell As Rang
Set rng = Range(Cells(1, "I"), Cells(Rows.Count, "I").End(xlUp)
For Each cell In rn
If Not IsEmpty(cell) The
Cells(cell.Row, "F").Value = Cells(cell.Row, "F").Value
& Cells(cell.Row, "G").Valu
Cells(cell.Row, "G").Value = cel
cell.ClearContent
End I
Nex

End Su

----- Yogi_Bear_79 wrote: ----

Code doesn't seemto be working
At first I thought it was working, then I noticed all it was doing wa
clearing the contents of the cells in column

When I comment out these two lines nothing happens at all

cells(rng.row,"G").Value = cel
cell.Clearcontent

Now I fI understood the code corrctly, editing out those two lines shoul
still allow F&G to concatanate. Which they are currently no


Actually

I've found that it does work sort of
It concatanates only F1&G1. Funny thing is it does it for as many cells i
column I that do have data so as an example

F1 = Hell
G1 = Worl

Column I has 4 cells that contain dat
nowF1 = Hello World World World Worl
 
Thanks..Changing rng to Cells did the trick



acw said:
Hi

Try this. If the range F1:F4 has a,b,c,d and G1:G4 has e,f,g,h and I1:I4 is 1,2,3,4 the output will be
F1:F4 ae, bf, cg, dh and G1:G4 1,2,3,4 and I1:I4 blank.


Tony
Sub bbb()
Dim rng As Range, cell As Range
Set rng = Range(Cells(1, "I"), Cells(Rows.Count, "I").End(xlUp))
For Each cell In rng
If Not IsEmpty(cell) Then
Cells(cell.Row, "F").Value = Cells(cell.Row, "F").Value _
& Cells(cell.Row, "G").Value
Cells(cell.Row, "G").Value = cell
cell.ClearContents
End If
Next

End Sub

----- Yogi_Bear_79 wrote: -----

Code doesn't seemto be working;
At first I thought it was working, then I noticed all it was doing was
clearing the contents of the cells in column I

When I comment out these two lines nothing happens at all:

cells(rng.row,"G").Value = cell
cell.Clearcontents

Now I fI understood the code corrctly, editing out those two lines should
still allow F&G to concatanate. Which they are currently not


Actually,

I've found that it does work sort of:
It concatanates only F1&G1. Funny thing is it does it for as many cells in
column I that do have data so as an example:

F1 = Hello
G1 = World

Column I has 4 cells that contain data
nowF1 = Hello World World World World

end of
the same row
in
 
Tom,

I couldn't accomplish half of the projects without you...a typo is nothing
but a learning tool for me!
 
Back
Top