Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Data filling question

Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would like
to copy Montreal and paste it up to cell A4 then start the same process with
Quebec. The number of time that Montreal (in the example could be paste can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
....


--
Mathieu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Data filling question

Hi,

It's either a helper column or a macro. using a helper column enter Montreal
in B1 then the formula below in B2 and drag down as far as required. If you
need a macro post back.

=IF(A2="",B1,A2)

Paste the new column over the original with paste special - values and then
delete the helper column
Mike

"Mathieu" wrote:

Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would like
to copy Montreal and paste it up to cell A4 then start the same process with
Quebec. The number of time that Montreal (in the example could be paste can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
...


--
Mathieu

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Data filling question

Hi,

It's need to be a macro. They can be hundreds of information to paste. I am
using town from Canada in my exemple. Let's assume we will use EVERY cities
in Canada. This is why a macro is required. I considered myself a
beginner-novice with VBA, I understand the basis for the moment but this one
is completely eluding me.

Thanks
--
Mathieu


"Mike H" wrote:

Hi,

It's either a helper column or a macro. using a helper column enter Montreal
in B1 then the formula below in B2 and drag down as far as required. If you
need a macro post back.

=IF(A2="",B1,A2)

Paste the new column over the original with paste special - values and then
delete the helper column
Mike

"Mathieu" wrote:

Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would like
to copy Montreal and paste it up to cell A4 then start the same process with
Quebec. The number of time that Montreal (in the example could be paste can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
...


--
Mathieu

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Data filling question

I anticipated that and have one written. this fills Column A as fra as there
are dat in Column B

Right click your sheet tab, view code and paste it in and run it.

Sub Canadian_Fill()
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow - 1)
For Each c In MyRange
If c.Offset(1).Value = "" Then
c.Offset(1).Value = c.Value
End If
Next
End Sub

Mike

"Mathieu" wrote:

Hi,

It's need to be a macro. They can be hundreds of information to paste. I am
using town from Canada in my exemple. Let's assume we will use EVERY cities
in Canada. This is why a macro is required. I considered myself a
beginner-novice with VBA, I understand the basis for the moment but this one
is completely eluding me.

Thanks
--
Mathieu


"Mike H" wrote:

Hi,

It's either a helper column or a macro. using a helper column enter Montreal
in B1 then the formula below in B2 and drag down as far as required. If you
need a macro post back.

=IF(A2="",B1,A2)

Paste the new column over the original with paste special - values and then
delete the helper column
Mike

"Mathieu" wrote:

Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would like
to copy Montreal and paste it up to cell A4 then start the same process with
Quebec. The number of time that Montreal (in the example could be paste can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
...


--
Mathieu

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Data filling question

Thank you, it is working great! I will now try to understand the difference
with yours and Per Jessen. Both are working Great!

Thanks again!
--
Mathieu


"Mike H" wrote:

I anticipated that and have one written. this fills Column A as fra as there
are dat in Column B

Right click your sheet tab, view code and paste it in and run it.

Sub Canadian_Fill()
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow - 1)
For Each c In MyRange
If c.Offset(1).Value = "" Then
c.Offset(1).Value = c.Value
End If
Next
End Sub

Mike

"Mathieu" wrote:

Hi,

It's need to be a macro. They can be hundreds of information to paste. I am
using town from Canada in my exemple. Let's assume we will use EVERY cities
in Canada. This is why a macro is required. I considered myself a
beginner-novice with VBA, I understand the basis for the moment but this one
is completely eluding me.

Thanks
--
Mathieu


"Mike H" wrote:

Hi,

It's either a helper column or a macro. using a helper column enter Montreal
in B1 then the formula below in B2 and drag down as far as required. If you
need a macro post back.

=IF(A2="",B1,A2)

Paste the new column over the original with paste special - values and then
delete the helper column
Mike

"Mathieu" wrote:

Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would like
to copy Montreal and paste it up to cell A4 then start the same process with
Quebec. The number of time that Montreal (in the example could be paste can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
...


--
Mathieu



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Data filling question

Hi

Try this:

Sub FillIn()
MyString = Range("A1").Value
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For r = 2 To LastRow
If Cells(r, 1) = "" Then
Cells(r, 1) = MyString
Else
MyString = Cells(r, 1).Value
End If
Next
End Sub

Regards,
Per

"Mathieu" skrev i meddelelsen
...
Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I
need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would
like
to copy Montreal and paste it up to cell A4 then start the same process
with
Quebec. The number of time that Montreal (in the example could be paste
can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
...


--
Mathieu


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Data filling question

Thank you, it is working great! I will now try to understand the difference
with yours and Mike H. Both are working Great!

Thanks again!
--
Mathieu


"Per Jessen" wrote:

Hi

Try this:

Sub FillIn()
MyString = Range("A1").Value
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For r = 2 To LastRow
If Cells(r, 1) = "" Then
Cells(r, 1) = MyString
Else
MyString = Cells(r, 1).Value
End If
Next
End Sub

Regards,
Per

"Mathieu" skrev i meddelelsen
...
Hi, I have an automated report (which we cannot change ;) ) that is not
applying data constantly, event if they are in the right order. What I
need
to do is to Copy the first line and paste it until the next value. I am
really stuck on this one. Thanks for your help. On the exemple. I would
like
to copy Montreal and paste it up to cell A4 then start the same process
with
Quebec. The number of time that Montreal (in the example could be paste
can
vary a lot from time to time and all the other fields below have the same
problem.


A B C
1 Montreal
2
3
4
5 Quebec
6
7
8
...


--
Mathieu



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
auto filling question vincent135 Excel Discussion (Misc queries) 2 June 13th 06 07:51 PM
excel novice question on filling in missing fields/cells TimR Excel Discussion (Misc queries) 3 May 19th 06 11:10 AM
Weird question on filling in typing in excel bwall Excel Discussion (Misc queries) 3 September 6th 05 09:24 PM
Filling question mkerstei Excel Discussion (Misc queries) 3 August 2nd 05 07:05 PM
Excel atuo filling cells- question [email protected] Excel Discussion (Misc queries) 1 May 16th 05 03:32 AM


All times are GMT +1. The time now is 01:21 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"