Copying Data Down the Column But Only Based on What's in Column A

Hello:
I have four columns in an Excel spreadsheet. Column A ("Item Number") is a
list of inventory items. Column B ("Location Code") is to contain the phrase
"CH" in each cell of column B. Column C ("Order Point Qty") contains
quantities in each cell of column C. Column D ("Number of Days") contains
the number "10" in each cell of column D.
At the end of this posting is VBA code for a macro in Excel's Visual Basic
Editor that I am using to essentially create this spreadsheet. I am having
trouble with the following lines of code:
Range("B2:B" & Cells(Cells.Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = "CH"
Range("C262:C" & Cells(Cells.Rows.Count, "A").End(xlUp).Row).FormulaR1C1
= "0"
Range("D2:D" & Cells(Cells.Rows.Count, "A").End(xlUp).Row).FormulaR1C1 =
"10"
You see, what I'm trying to accomplish is the following:
(1) Place "CH" in each cell of column B but only for as many cells as what
is filled in column A (i.e. only for as many cells as there are inventory
items in column A) and to do so only from B2 onward,
(2) Place the number "0" in cell C262 and in each succeeding cell of column
C afterward but again only for as many cells as what is filled in column A
(i.e. only for as many cells as there are inventory items in column A), and
(3) Place the number "10" in each cell of column D but only for as many
cells as what is filled in column A (i.e. only for as many cells as there are
inventory items in column A) and to do so only from D2 onward.
I thought that the three lines of code that I just mentioned woudld
accomplish this, but they did not.
Also. at the end of the code that i have attached I placed code to delete
Sheet1 of the workbook, but the macro did not do so. Why is that and how can
I fix it?
Finally, in other columns of the spreadsheet, I have done such things as
create formulas and place numeric cell formats. Similar to what I am trying
to do for the three columns that I mentioned a little while ago, what formula
do I use to say "hey, only do this for as many inventory items as what are in
column A?
Code follows:
ActiveWindow.LargeScroll ToRight:=1
ActiveWindow.SmallScroll ToRight:=-5
Range("L2:L" & Cells(Cells.Rows.Count, "J").End(xlUp).Row).FormulaR1C1 =
"=IF(RC[-2]<RC[-5], RC[-2]/RC[-5], 0)"
Columns("L:L").NumberFormat = "0%"
Range("L2:L" & Cells(Cells.Rows.Count, "J").End(xlUp).Row).Value =
Range("L2:L" & Cells(Cells.Rows.Count, "J").End(xlUp).Row).Value
Range("L1").Value = "% Below Min"
Application.CutCopyMode = False
Columns("L:L").EntireColumn.AutoFit
ActiveWindow.LargeScroll ToRight:=-1
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlAverage, TotalList:=Array(4,
5, _
6, 7, 8, 9, 10, 11, 12), Replace:=True, PageBreaks:=False,
SummaryBelowData:= _
True
ActiveSheet.Outline.ShowLevels RowLevels:=2
Cells.Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Sheet2").Select
Cells.Select
ActiveSheet.Paste
Selection.Columns.AutoFit
Range("A1").Select
Application.CutCopyMode = False
Range("A1:L632").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("H2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*2"
Range("H2").Select
Selection.Copy
Columns("H:H").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "0"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Order Point Qty"
Columns("B:G").Select
Selection.Delete Shift:=xlToLeft
Columns("C:G").Select
Selection.Delete Shift:=xlToLeft
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Range("B2").Select
ActiveCell.FormulaR1C1 = "'=LEFT(A2,LEN(A2)-8)"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],LEN(RC[-1])-8)"
Range("B2").Select
Selection.Copy
Columns("B:B").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Range("B1").Select
ActiveCell.FormulaR1C1 = "Location Code"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Number of Days"
Range("D1").Select
Columns("D:D").ColumnWidth = 15
Range("B2:B" & Cells(Cells.Rows.Count, "A").End(xlUp).Row).FormulaR1C1 =
"CH"
Range("C262:C" & Cells(Cells.Rows.Count, "A").End(xlUp).Row).FormulaR1C1
= "0"
Range("D2:D" & Cells(Cells.Rows.Count, "A").End(xlUp).Row).FormulaR1C1 =
"10"
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
Range("A1").Select
End Sub

DVD Copy Pro for Mac[b]DVD Copy Pro for Mac[/b] is a DVD copy software that can support D9 to D5 compression. With simple operation, it can save DVD in four different ways including directly burning to DVD disc, saving as DVD folder, copying into DVD media format that can be played by DVD Player directly, and converting as ISO file for easy movie management. Now this cool Mac DVD Copy also supports the latest released Snow Leopard.
You can download [b][url=http://www.dvd-copy-mac.net/download/dvd-copy-pro-mac.zip]DVD Copy Pro for Mac[/url][/b] freely right now.
[b]More information:[/b][quote]http://www.dvd-...

collect data from mail mergeIf I create a mail merge in Word with some blank space for data entry, can I
collect the feedbacks from returned word file, and consolidate them in excel ?
Can you give a little more information about what you are trying to do.
Excel is a pretty powerful tool; almost certainly you can do what you want.
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
"data collection" wrote:
> If I create a mail merge in Word with some blank space for data entry, can I
> collect the feedbacks from returned wo...

Data labels #9My data labels in my bar chart don't look the same after printing as they do
on the screen. I try to manually move them but they still don't look the
same after printing. Any thoughts?
Are they embedded charts or chart sheets? If you select an embedded chart
and print it, it will print as a chart sheet, and there's likely to be a
fair amount of distortion. When printing and embedded chart, print the
worksheet it's on. When printing a chart sheet, uncheck the setting in Tools
menu > Options > Charts for Chart Sizes to Window Frame.
- Jon
-------
Jon Peltier, Micr...

Import/copy calendar in Outlook 2003I got a new computer and installed Office 2003, and wanted to move my
calendar to the new PC. I created a new data file called Personal
Folders from Old PC.
I wanted to copy my calendar OVER my current one in Personal Folders,
but don't see a way to do so. I can copy my old calendar into the
Pesonal Folders, but can't delete the new, empty Calendar.
So I have Calendar, and Calendar 1 under my Personal Folders. Any way to
just import/copy my reminders/appointments into my new calendar?
Thanks for any advice.
Ck
G'Day Cathy,
1. Use the Folder List
2. Click on the OLD Cal...

Cant se some columns! Why?I have a spreadsheet that displays COL A and them col BL-BM-BN etc
How do I get to see the cols B to BK
I am working with EXCEL 2007
Thanks
Either columns B through BK are hidden (most likely), or the Window is frozen
and you've scrolled way over to the right, bringing column BL next to A.
Assuming they're just hidden,
Click on the 2 that identifies row 2 so that the entire row is selected, then
On the [HOME] tab, in the CELLS group, pull down the "Format" list and
choose Hide and Unhide and click the UNHIDE COLUMNS option.
If its a Frozen window thin...

Copy info from one workbook to another?I have a problem
I have a workbook with the function i want like a discribe here. The
problem is i want to split the workbook but i don`t know how.
Is it possible to have a main workbook with information from other
workbooks at each worksheet? I have 20
workbooks with information. I would like to have a main workbook with on
sheet1 every row from the
20workbooks with category1, on sheet2 every row from the 20workbooks with
category2, etc, etc. The information
in the 20workbooks in always only on sheet. The Colum in which the data is
has no fix end. I go to fill in the
rows trough a...

Secondary CopyHi,
My customer using Great Plains modified report(Primary Copy).
Now he wants new report something similar to the modified GP report with
very few changes.
I tried to copy the modified report and planned to use us a secondary copy.
But the report has temp tables, so I am unable to make secondary copy.
Can some one help me in how to make a new report something similar to the
modified report, where to launch it.
Whether it is possible throught VBA & Modifier?
Regards
Selvakumar.S
A report with a temporary table can only be a primary copy.
This is because only a primary copy can b...

local copy of mailHow do you store a copy of all your mail on you local computer when using
Exchange?
You setup an OST/Offline Folders file. Check with your mail admin if they
support that configuration.
"Brandon Baker" <brandon@discussions.microsoft.com> wrote in message
news:epNKuJ19FHA.4004@TK2MSFTNGP14.phx.gbl...
> How do you store a copy of all your mail on you local computer when using
> Exchange?
>
...

Outlook 2000 SP3How can I copy my mail and calendar to CD so that I can
take my received and sent mail history to a new computer
with Outlook installed? Thanks.
>-----Original Message-----
>How can I copy my mail and calendar to CD so that I can
>take my received and sent mail history to a new computer
>with Outlook installed? Thanks.
>.
>
All your data saves in
C:\Documents and Settings\Username\Local
Settings\Application Data\Microsoft\Outlook\archive.pst
and
C:\Documents and Settings\Evgeni\Local
Settings\Application Data\Microsoft\Outlook\outlook.pst
You can either install instan...

Columns won't Hide!I'm trying to hide columns in a ss and I get the
message, "Cannot Shift Objects off Sheet.". I'm able to
hide some columns but Excel seems to reach a limit.
Help!
You may have something in columns that you don't know about.
"Tom" <thomas.hamilton@med.va.gov> wrote in message
news:051e01c38d97$7b458e80$a001280a@phx.gbl...
> I'm trying to hide columns in a ss and I get the
> message, "Cannot Shift Objects off Sheet.". I'm able to
> hide some columns but Excel seems to reach a limit.
>
> Help!
>-----Original Mess...

Copy picture ossice wizardI have project 2007 standard edition, but the button is not working at all?
Any suggestions
Hi,
The wizard is IMHO useless.
Go to Roport, Copy Picture and do without the Wizard what millions have done
before the Wizard existed.
HTH
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
"Enrique" <Enrique@discussions.microsoft.com> wrote in message
news:72B5AA6C-67AE-468D-B6AE-FF16F52E57BD@microsoft.com...
>I have project 2007 standard edition, but the bu...

Copy and paste versus copy and insert copied cellsWhat is the difference between these commands?
Try them, it is pretty easy to see the difference
--
Regards,
Peo Sjoblom
"Alana" <Alana@discussions.microsoft.com> wrote in message
news:879FED29-5541-41B0-BB2C-7108D42ED593@microsoft.com...
> What is the difference between these commands?
...

Log data in a shared workbookHi all
Is it possible to have a spreadsheet which logs data from anothe
without over writing each other's data, even though several colleague
are inputting and saving in this shared sheet at different times.
Eg.
Sheet 1 has various data
Sheet 2 - A1,2,3, etc = first save
Sheet 3 - B1,2,3, etc = second save
Etc.
...for the day
Cheers
Joe
--
Message posted from http://www.ExcelForum.com
Joey
Would you consider writing to a CSV file? You could use VBA's text file
functions to write directly to the file, but the file would still open in
Excel. One advantage would be that...

subtotal copy and pasteHi
I have used the subtotal option in Excel and this is fine. I have also
collasped the list so only the subtotal for each category is visible. However
I want to copy and paste this list (just the subtotal) into another sheet
When I do this it expands and shows all the results. Is it possible to just
copy the visible bit. I have looked in paste special but no luck
Cheers Hager
On Jan 21, 6:38=A0am, Hager <Ha...@discussions.microsoft.com> wrote:
> Hi
>
> I have used the subtotal option in Excel and this is fine. I have also
> collasped the list so only the...

Microsoft Knowledge Base ArticleI am having the exact issue related to the KB article
mentioned in the subject. I try to follow support links,
but when I put my product key for my Exchange server, it
tells me that it is not supported for the language I
selected. I go back to the first page and the language is
United Stated. This is a licensed copy of Exchange 5.5
and I need this patch mention in the article to resolve
my issue. How can I obtain this patch when I keep getting
messages that I have the wrong language selected? PLEASE
HELP ASAP!
Hi Ralph,
You must call Microsoft to get the fix, just mention the
artic...

Business Portal "Copy to Excel" not working in Query pagesHi,
I am using Business Portal 4.0. When browsing through one of the queries
pages in Business Portal, i clicked "Copy to Excel" icon. I got an error
saying "The Office Web Components (OWC) must be installed to copy results to
Excel." at the bottom.
I am using Office 2007 on my machine. I came to know that Microsoft Office
Web Components will no longer be shipping in Microsoft Office. I tried
installing Office 2003 Add-in: Office Web Components from
http://www.microsoft.com/downloads/details.aspx?familyid=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en
a...

column headings in numbers vs lettersFor some reason all my excel files now display columns as numbers rather than
letters. How can I change back to letters? Why are all my old files also
now reading in numbered columns?
This is a setting of Excel, not of your files.
Tools>Options>General, uncheck R1C1 Reference style
--
Kind Regards,
Niek Otten
Microsoft MVP - Excel
"garyflood" <garyflood@discussions.microsoft.com> wrote in message
news:6870D172-C11D-4FF9-A7D8-48BE89149DF8@microsoft.com...
> For some reason all my excel files now display columns as numbers rather
> than
> letters. How...

line column Pivot ChartsAccess 2003 does not support combined Line/Column Charts, but Excel does. Has
the capability been added to Access 2007?
Access does support a series displayed as a bars and another series as line.
--
Duane Hookom
MS Access MVP
Help me support UCP http://www.access.hookom.net/UCP/Default.htm
"John" <John@discussions.microsoft.com> wrote in message
news:A0DD25F6-D99A-44C3-812B-416776BED8AF@microsoft.com...
> Access 2003 does not support combined Line/Column Charts, but Excel does.
> Has
> the capability been added to Access 2007?
...

Copying graphsHi Is it possible to range value a graph ie I would like to copy the graph to
another workbook, show all the information but without the links?
Thanks
You could copy the chart as a picture, then paste it wherever you want.
Select the chart, hold Shift while clicking on the Edit menu, Choose Copy
Picture, and select the On Screen and As Picture options, then go to the
other workbook/sheet and Paste.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______
"Dixie" <Dixie@discussions.micr...

Copying ViewsIs there any way to copy the views under leads so that i can modify them and
create different ones. I need to create 15 views and i do not want to do all
of them one at a time.
Even if there is a way to do it in sql i would love to know
--
IT Manager
It can be done in SQL, though it's unsupported. What you want need to do is
use INSERT ... SELECT to copy rows in the savedquerybase, and give a
different savedqueryid
For a supported route you can use the CRM web service and create new
instances of savedquery. The following article describes how to do this for
the userquery, and coul...

Comparing two columns of data and Highlighting the DifferencesI have values (mix of text and numbers)in column A and B. Each cell
value in column B is also in column A. I want to highlight (Change
Fill color to Red) for example) all those cells in column A that are
also present in the column B. Any help writting a Macro will be highly
appreciated. Thanks in advance.
Harapa
No macro needed. Select Column A's Data. Use Format/Conditional Formatting.
Change "Cell Value Is" to "Formula Is"
Assuming A1 is the active cell, enter this formula:
=NOT(ISERROR(MATCH(A1,$B$1:$B$500,0)))
click Format, click Patterns tab, select Red fill patte...

Import data from Parameter QueryI am trying to import data into Excel from a parameter
query in Access. I keep getting a message "Too few
parameters". I have tried supplying the parameter
information via the filter in the import wizard but this
did not work. I want to avoid removing the parameter in
Access. Is there anyway around this?
...