Posts by Retroshift

    MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question

    crossposted at: mrexcel.com/board/threads/macr…d-import-columns.1205668/

    Hi,

    In my worksheet, I would like to add a macro which does the following at once: 1) refresh the active workbook, 2) clear the contents of a specific worksheet, 3) import columns data from a closed workbook, 4) refer to the path of the closed workbook based on cell data in the open workbook, 5) identify the columns data until the last row, and 6) add a messagebox.
    Below is what I got so far but it is not complete. Can anyone help me out?


    Hi VBA-experts,
    I'm looking for a working code to clear conditional formatting of different cells before printing and restore them after printing. The macro should run automatically when I want to print the specific worksheet and also restore the conditional formatting after printing. The removal of the conditional formatting cells should be visible on the print preview of the Excel document.


    I had an idea for some basic code but it is far from complete. (no use of buttons or datavalidation please and the final document is printed in color (but not the cleared conditional formatting cells))
    Any help would be greatly appreciated.

    Code
    Private Sub Workbook_BeforePrint(Cancel As Boolean) 
         
         
        Sheets("Sheet1").Range("B6,B10").FormatConditions.Delete 
         
    End Sub


    [COLOR="#FF0000"]MOD Edit[/COLOR]:
    Moved from the Word forum.

    Dear Excel experts,


    I have two cells (G91,G100) on "Sheet2" which are conditionally formatted (highlighting background RGB(201, 243, 240)) when they are empty.
    So, when I type text in cell G91, the highlighted background disappears, and when I type no text in formatted cell G100, the highlight still remains in cell G100. However, I do not wish to print the highlighted background in empty cell G100.
    The highlights are only used to edit in screen view, so they should not be printed.


    I found some code online and altered it, but it does not seem to work. Any suggestions or alternative code on how to make it work?


    Code
    Sub FixCells()Set Rng = Range("G91,G100")Rng.FormatConditions(1).Delete  'Deletes all C/F from RngActiveSheet.PrintPreviewRng.Select    Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=ISBLANK($G$91,$G$100)"    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority    With Selection.FormatConditions(1).Interior          'You will need to get the C/F settings from your original set-up and reassign below        .PatternColorIndex = xlAutomatic        .Color = RGB(201, 243, 240)        .TintAndShade = 0        .PatternTintAndShade = 0            End With    Selection.FormatConditions(1).StopIfTrue = FalseEnd Sub



    [COLOR="#FF0000"]MOD Edit[/COLOR]:
    Reposted http://www.ozgrid.com/forum/showthread.php?t=201253