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 text only if the cell is not empty


-----Original Message-----
Please can somebody help?

I want to run a macro which starts in cell a1 and if it

is not blank to
copy that cells value into another cell and print the

sheet. I want
then for the macro to move down to the next non-blank

cell and do the
same until it's visited all non-blank cells in the range

a1:a50.

Thanks in anticipation!!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/

.

I didn't put the printing command in, but here is
everything else.

Sub CopyNonBlank()
Range("a2").Select
For counter = 1 To 10
If ActiveCell < "" Then
i = 0
Selection.Copy
ActiveCell.Offset(0, 2).Select
Do Until ActiveCell.Offset(-1, 0) < ""
ActiveCell.Offset(-1, 0).Select
i = i + 1
Loop
ActiveSheet.Paste
ActiveCell.Offset(i, -2).Select
End If
ActiveCell.Offset(1, 0).Select
Next counter
End Sub

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 specific value in cell into next empty row on different sheet michaelberrier Excel Discussion (Misc queries) 1 December 29th 06 09:54 PM
Text Overwriting next empty cell Is this a stupid Question? Excel Discussion (Misc queries) 2 July 13th 06 02:10 PM
Copying Data to next available empty cell in cloum chanderjeet Excel Worksheet Functions 3 April 19th 06 10:22 PM
Copy a string text to cell if another cell not empty Pasmatos Excel Discussion (Misc queries) 0 November 25th 05 03:54 PM
Text wider than one cell is not displayed in the next empty cell Len Pace Excel Discussion (Misc queries) 5 February 18th 05 12:24 AM


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