Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying Cell Contents throughout spreadsheet

That worked perfectly! Thank you so much!

--
Message posted from http://www.ExcelForum.com

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
copying cell contents from one worksheet to another (re-sorted lis Peter Excel Discussion (Misc queries) 2 October 20th 09 06:24 PM
Copying format to a new cell, w/o overwriting destination cell contents James C Excel Discussion (Misc queries) 1 October 18th 05 08:02 PM
Copying cell contents to a list Peter Horrocks New Users to Excel 3 October 1st 05 10:15 PM
If Statement and copying all of cell contents. andrewm Excel Worksheet Functions 0 June 29th 05 04:37 AM
Copying cell contents to add to existing contents in another cell Dean Sawas Excel Programming 3 April 2nd 04 09:00 PM


All times are GMT +1. The time now is 08:52 PM.

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"