Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
A simple 'If...Then...' code needed?
Please can somebody help?
I want to run a macro which goes to cell a1 and if it is not blank to copy that cells value into another cell (b1) and print the sheet. I want then for the macro to move down to the next non-blank cell in column A and do the same until it's visited all non-blank cells in the range a1:a50. I've been struggling with this for days and spent hours seaching the net, but just can't find an answer. Thanks in anticipation!! __________________ Big Chris ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
A simple 'If...Then...' code needed?
try this
Sub printem() For Each c In [d1:d6] If Len(c) 0 Then [b10] = c ActiveSheet.PrintPreview End If Next c End Sub "Big Chris" wrote in message ... Please can somebody help? I want to run a macro which goes to cell a1 and if it is not blank to copy that cells value into another cell (b1) and print the sheet. I want then for the macro to move down to the next non-blank cell in column A and do the same until it's visited all non-blank cells in the range a1:a50. I've been struggling with this for days and spent hours seaching the net, but just can't find an answer. Thanks in anticipation!! __________________ Big Chris ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
A simple 'If...Then...' code needed?
for each cell in Range("A1:A50").SpecialCells(xlConstants)
cell.offset(0,1).Value = cell.Value cell.parent.Printout Next Assumes the cells have constant values in them. If they will be formulas for each cell in Range("A1:A50").SpecialCells(xlformulas) if Cell.Value < "" then cell.offset(0,1).Value = cell.Value cell.parent.Printout End if Next -- Regards, Tom Ogilvy "Big Chris" wrote in message ... Please can somebody help? I want to run a macro which goes to cell a1 and if it is not blank to copy that cells value into another cell (b1) and print the sheet. I want then for the macro to move down to the next non-blank cell in column A and do the same until it's visited all non-blank cells in the range a1:a50. I've been struggling with this for days and spent hours seaching the net, but just can't find an answer. Thanks in anticipation!! __________________ Big Chris ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
simple loop needed please | Excel Discussion (Misc queries) | |||
Simple formula needed | Excel Discussion (Misc queries) | |||
Another simple formula needed | Excel Worksheet Functions | |||
Help needed in a simple task | Excel Discussion (Misc queries) | |||
simple (i think) UDF debug help needed | Excel Discussion (Misc queries) |