Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Fill down a row

WinXP Pro MSOffice 2003 Pro

I have a spreadsheet with hundreds of rows and 15 columns

Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.

I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.

Could someone help me with this, or point me to an example somewhere so
I can help myself?

I sure appreciate your time and effort.
Thanks
Joanne
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Fill down a row

On Jan 16, 5:13*pm, Joanne wrote:
WinXP Pro MSOffice 2003 Pro

I have a spreadsheet with hundreds of rows and 15 columns

Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.

I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.

Could someone help me with this, or point me to an example somewhere so
I can help myself?

I sure appreciate your time and effort.
Thanks
Joanne



hello, try this:

Sub filldwn()
Dim cell As Range
'adjust the range below to fit your needs
For Each cell In Range("A1:A50")
If cell.Value = "" Then
cell.Select
ActiveCell.End(xlUp).Copy cell
End If
Next cell
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Fill down a row

Thank you again for your help. You make my job easier with your
willingness and promptness in answering my sos
I want to understand the code so that I can better learn to use it
myself.

This code looks like it looks at the number of rows on the worksheet,
then reads each cell value. If the value is nothing, then it selects the
cell and copies something to it.

What I don't get is how does it know what to copy to the empty cells and
how does it know when to read a cell that is not empty and then start
copying that. I think I understand that no variable is needed because we
are simply copying what we found in the cell. Again though, how did we
find it!!??? I am so confused.

ActiveCell.End(xlUp).Copy cell
This is the line I don't understand well

Thank you
Joanne


GTVT06 wrote:

On Jan 16, 5:13 pm, Joanne wrote:
WinXP Pro MSOffice 2003 Pro

I have a spreadsheet with hundreds of rows and 15 columns

Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.

I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.

Could someone help me with this, or point me to an example somewhere so
I can help myself?

I sure appreciate your time and effort.
Thanks
Joanne



hello, try this:

Sub filldwn()
Dim cell As Range
'adjust the range below to fit your needs
For Each cell In Range("A1:A50")
If cell.Value = "" Then
cell.Select
ActiveCell.End(xlUp).Copy cell
End If
Next cell
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Fill down a row

On Jan 16, 6:57*pm, Joanne wrote:
Thank you again for your help. You make my job easier with your
willingness and promptness in answering my sos
I want to understand the code so that I can better learn to use it
myself.

This code looks like it looks at the number of rows on the worksheet,
then reads each cell value. If the value is nothing, then it selects the
cell and copies something to it.

What I don't get is how does it know what to copy to the empty cells and
how does it know when to read a cell that is not empty and then start
copying that. I think I understand that no variable is needed because we
are simply copying what we found in the cell. Again though, how did we
find it!!??? I am so confused.

ActiveCell.End(xlUp).Copy cell
This is the line I don't understand well

Thank you
Joanne



GTVT06 wrote:
On Jan 16, 5:13 pm, Joanne wrote:
WinXP Pro MSOffice 2003 Pro


I have a spreadsheet with hundreds of rows and 15 columns


Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.


I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.


Could someone help me with this, or point me to an example somewhere so
I can help myself?


I sure appreciate your time and effort.
Thanks
Joanne


hello, try this:


Sub filldwn()
Dim cell As Range
'adjust the range below to fit your needs
For Each cell In Range("A1:A50")
If cell.Value = "" Then
cell.Select
ActiveCell.End(xlUp).Copy cell
End If
Next cell
End Sub- Hide quoted text -


- Show quoted text -


No problem, any time! heres a summary of what the code is doing:

'Setting the range to which cells will be searched and filled
For Each cell In Range("A1:A50")
'If a cell is blank in the above row then....
If cell.Value = "" Then
'Select it!
cell.Select
'With the "" cell selected, go up to the previous
'it's like using Ctrl Up. Then copy that cell and paste it
' to "cell" which is the blank cell that was selected
ActiveCell.End(xlUp).Copy cell
End If
'repeats the process for the next cell
Next cell

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Fill down a row

The code works so sweet - I love it!!

Thank you for the explanation. It is kind of confusing to know you are
filling 'down' by using .end(xlUp)

Joanne

GTVT06 wrote:

On Jan 16, 6:57 pm, Joanne wrote:
Thank you again for your help. You make my job easier with your
willingness and promptness in answering my sos
I want to understand the code so that I can better learn to use it
myself.

This code looks like it looks at the number of rows on the worksheet,
then reads each cell value. If the value is nothing, then it selects the
cell and copies something to it.

What I don't get is how does it know what to copy to the empty cells and
how does it know when to read a cell that is not empty and then start
copying that. I think I understand that no variable is needed because we
are simply copying what we found in the cell. Again though, how did we
find it!!??? I am so confused.

ActiveCell.End(xlUp).Copy cell
This is the line I don't understand well

Thank you
Joanne



GTVT06 wrote:
On Jan 16, 5:13 pm, Joanne wrote:
WinXP Pro MSOffice 2003 Pro


I have a spreadsheet with hundreds of rows and 15 columns


Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.


I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.


Could someone help me with this, or point me to an example somewhere so
I can help myself?


I sure appreciate your time and effort.
Thanks
Joanne


hello, try this:


Sub filldwn()
Dim cell As Range
'adjust the range below to fit your needs
For Each cell In Range("A1:A50")
If cell.Value = "" Then
cell.Select
ActiveCell.End(xlUp).Copy cell
End If
Next cell
End Sub- Hide quoted text -


- Show quoted text -


No problem, any time! heres a summary of what the code is doing:

'Setting the range to which cells will be searched and filled
For Each cell In Range("A1:A50")
'If a cell is blank in the above row then....
If cell.Value = "" Then
'Select it!
cell.Select
'With the "" cell selected, go up to the previous
'it's like using Ctrl Up. Then copy that cell and paste it
' to "cell" which is the blank cell that was selected
ActiveCell.End(xlUp).Copy cell
End If
'repeats the process for the next cell
Next cell




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Fill down a row

On Jan 16, 8:53*pm, Joanne wrote:
The code works so sweet - I love it!!

Thank you for the explanation. It is kind of confusing to know you are
filling 'down' by using .end(xlUp)

Joanne



GTVT06 wrote:
On Jan 16, 6:57 pm, Joanne wrote:
Thank you again for your help. You make my job easier with your
willingness and promptness in answering my sos
I want to understand the code so that I can better learn to use it
myself.


This code looks like it looks at the number of rows on the worksheet,
then reads each cell value. If the value is nothing, then it selects the
cell and copies something to it.


What I don't get is how does it know what to copy to the empty cells and
how does it know when to read a cell that is not empty and then start
copying that. I think I understand that no variable is needed because we
are simply copying what we found in the cell. Again though, how did we
find it!!??? I am so confused.


ActiveCell.End(xlUp).Copy cell
This is the line I don't understand well


Thank you
Joanne


GTVT06 wrote:
On Jan 16, 5:13 pm, Joanne wrote:
WinXP Pro MSOffice 2003 Pro


I have a spreadsheet with hundreds of rows and 15 columns


Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.


I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.


Could someone help me with this, or point me to an example somewhere so
I can help myself?


I sure appreciate your time and effort.
Thanks
Joanne


hello, try this:


Sub filldwn()
Dim cell As Range
'adjust the range below to fit your needs
For Each cell In Range("A1:A50")
If cell.Value = "" Then
cell.Select
ActiveCell.End(xlUp).Copy cell
End If
Next cell
End Sub- Hide quoted text -


- Show quoted text -


No problem, any time! heres a summary of what the code is doing:


'Setting the range to which cells will be searched and filled
For Each cell In Range("A1:A50")
'If a cell is blank in the above row then....
If cell.Value = "" Then
'Select it!
cell.Select
'With the "" cell selected, go up to the previous
'it's like using Ctrl Up. Then copy that cell and paste it
' to "cell" which is the blank cell that was selected
ActiveCell.End(xlUp).Copy cell
End If
'repeats the process for the next cell
Next cell- Hide quoted text -


- Show quoted text -


Glad I could help!
well .end(xlUp) is actually going up to get the value of the cell
above the "" cell it can use that value to assign it to the "" cell.
Sorry if I'm explaining it in a confusing way
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
what is the alternative for PlotArea.Fill. Fill property is hidden srinivas Tirumala[_2_] New Users to Excel 1 September 4th 09 09:36 PM
Fill handle fill down alternative methods question Rufio Excel Discussion (Misc queries) 1 May 18th 09 04:28 PM
Some formulas don't track copies, pastes, fill right, fill down whiten Excel Discussion (Misc queries) 2 October 1st 06 04:41 PM
Fill in form to type Item descrictions and costs and fill in funct cradino Excel Worksheet Functions 0 July 16th 06 08:44 PM
I have a list of data, fill in the gaps. FILL function won't work Triv Excel Discussion (Misc queries) 1 September 17th 05 02:33 PM


All times are GMT +1. The time now is 09:25 AM.

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

About Us

"It's about Microsoft Excel"