View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
thomsonpa thomsonpa is offline
external usenet poster
 
Posts: 31
Default copying if value in cell from range of cells

Many thanks, works perfectly. What would I do if it wasnt for this community.

"Stefi" wrote:

Try this:

Sub test()
hitcounter = 1
endA = Range("A" & Rows.Count).End(xlUp).Row
For Each acell In Range("A2:A" & endA)
If Not IsEmpty(Range("J" & acell.Row)) Or _
Not IsEmpty(Range("K" & acell.Row)) Or _
Not IsEmpty(Range("L" & acell.Row)) Then
hitcounter = hitcounter + 1
Worksheets("othersheet").Range("A" & hitcounter).Value =
acell.Value
Worksheets("othersheet").Range("B" & hitcounter).Value =
Range("J" & acell.Row).Value
Worksheets("othersheet").Range("C" & hitcounter).Value =
Range("K" & acell.Row).Value
Worksheets("othersheet").Range("D" & hitcounter).Value =
Range("L" & acell.Row).Value
End If
Next acell
End Sub

Regards,
Stefi

€˛thomsonpa€¯ ezt Ć*rta:

I am looking vor the visual basic code to perform the following action.
I have column "a" with data in every cell, columns "j, k and l 'may have
data in them.

If there is data in j, k or l I want to copy the data from "a" into another
worksheet in column "a", then the data in j, k or l in either b, c or d on
the other worksheet on the same row number as the information in column a.
Since column a has over 120 rows I am looking for a simple solution to this.
Any help in pointing me in the right direction would be helpful.