#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Loop

Hi All,

I have got a question i can't find he

I have to files: File1.xls and File2.xls

In file1.xls there is a Cell (C6) that has a value I want to copy to
File2.xls in Column A as long there is a value in Column B of File2.xls
I need to do a loop but i can't get the correct code for it.

Can someone help me with this?

Thanks!

BR
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Loop

Sub demo()
Workbooks("File2.xls").Activate
Sheets("Sheet1").Activate
For i = 1 To Rows.Count
If IsEmpty(Cells(i, "B")) Then
Exit For
End If
Next
i = i - 1

Set r2 = Range("A1:A" & i)
Set r1 = Workbooks("File1.xls").Sheets("Sheet1").Range("C6" )

r1.Copy r2
End Sub

--
Gary''s Student - gsnu200731
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
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM


All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"