ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range Loop (https://www.excelbanter.com/excel-programming/357292-range-loop.html)

lbargers

Range Loop
 

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


--
lbargers
------------------------------------------------------------------------
lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798
View this thread: http://www.excelforum.com/showthread...hreadid=526899


Tom Ogilvy

Range Loop
 
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(xl up))
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

--
Regards,
Tom Ogilvy


"lbargers" wrote in
message ...

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


--
lbargers
------------------------------------------------------------------------
lbargers's Profile:

http://www.excelforum.com/member.php...o&userid=32798
View this thread: http://www.excelforum.com/showthread...hreadid=526899




lbargers[_2_]

Range Loop
 

Tom, thanks for your reply.. How can I specify the location of th
seperate .xls spreadsheets in the example you provided

--
lbarger
-----------------------------------------------------------------------
lbargers's Profile: http://www.excelforum.com/member.php...fo&userid=3279
View this thread: http://www.excelforum.com/showthread.php?threadid=52689



All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com