Range Loop

  • Thread starter Thread starter lbargers
  • Start date Start date
L

lbargers

Hi,

I have an excel spreadsheet that contains data in a number of columns
(some contain data and some do not). I would like to have a seperate
spreadsheet check the range (E3:IV3), if data is present in this row, I
would like the seperate spreadsheet to write the cell values of the
range to a seperate spreadsheet. How can I approach this issue?

Thanks in advance for anyhelp
 
Can we conclude that if there is data in Column E, then the row should be
copied

Sub CopyData()
Dim rng as Range, rng1 as Range
Dim rng2 as Range
With Activesheet
set rng = .Range(.cells(3,"E"),.Cells(rows.count,"E").End(xlup))
On error resume next
set rng1 = rng.Specialcells(xlconstants)
On Error goto 0
if not rng1 is nothing then
set rng2 = intersect(rng1.EntireRow, .Columns("E:IV"))
rng2.copy Destination:=Worksheets("Data").Range("A1")
end if
End With
End Sub
 
Tom, thanks for your reply.. How can I specify the location of th
seperate .xls spreadsheets in the example you provided
 

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