Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying Cell Contents throughout spreadsheet
I'm new with programming in Visual Basic, and I am attempting to cop
cell contents into the cells below it. For example, we have a spreadsheet lists each location in a cell, (ex A1) and then has numerous assets listed throughout until it gets to th next location (ex. A39). How can I get the first cell to copy into al the empty cells until it gets to the next location -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying Cell Contents throughout spreadsheet
select the column
Do edit =Goto Special and select Blanks A2 should be the activeCell in the formula bar type =A1 then do Ctrl+Enter rather than Enter. This should fill all the blank cells. Now you can select column A and do Edit=Copy, then immediately Edit=Pastespecial and select Values. This will replace the formulas with the values they display. -- Regards, Tom Ogilvy "kaytee978 " wrote in message ... I'm new with programming in Visual Basic, and I am attempting to copy cell contents into the cells below it. For example, we have a spreadsheet lists each location in a cell, (ex. A1) and then has numerous assets listed throughout until it gets to the next location (ex. A39). How can I get the first cell to copy into all the empty cells until it gets to the next location? --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying Cell Contents throughout spreadsheet
How about:
Code ------------------- Sub test() Dim i As Long Dim iLastRow Dim strLast As String strLast = Range("A1").Value 'Assumes column B has data in the last row iLastRow = Range("B65536").End(xlUp).Row For i = 1 To iLastRow 'Checks for an empty cell If Range("A" & i).Value = "" Then Range("A" & i).Value = strLast End If strLast = Range("A" & i).Value Next End Su ------------------- Assumptions: - All of the A column cells are either blank or have data to be copie down. - Column B has data in the last row you want to copy to. If this i not true, change from B65536 to C or D or wherever. If there is n pattern, set iLastRow equal to the last row for data. -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying Cell Contents throughout spreadsheet
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copying cell contents from one worksheet to another (re-sorted lis | Excel Discussion (Misc queries) | |||
Copying format to a new cell, w/o overwriting destination cell contents | Excel Discussion (Misc queries) | |||
Copying cell contents to a list | New Users to Excel | |||
If Statement and copying all of cell contents. | Excel Worksheet Functions | |||
Copying cell contents to add to existing contents in another cell | Excel Programming |