Clear & Set Print Range Based On Selection

Feb 22, 2008

Is there are macro that will allow me to: Clear Print Area, then Set Print Area based on user selection and finally print the Print Area to fit 1 page? I tried to search for solutions, but couldn't find any that matched my problem.

View 2 Replies


ADVERTISEMENT

Clear Contents Based On A Selection In Another Cell.

Feb 21, 2007

If I have a pick list, or drop-down list, in cell B21 and one of the options in that list is "Clear", how can I get the contents of cell C21 to be cleared when I select the "Clear" option in B21?

Constraint... Don't want to use VBA.

I am thinking of hiding a formula somewhere other than in C21 that evaluates B21 and does an If Then kind of deal to clear C21.

View 9 Replies View Related

Clear Cells Of Values Based On Cell Selection

Jun 13, 2008

A project I am working on calls for me to implement a macro that will clear the contents of a cell (but not affect the validation list it contains) based on the selection of another cell or cells. So on the simplified attached example, I need to achieve the following;

On the fist row of options, if cell "C3" is selected, then the contents in cell "D3" are cleared. If cell "B3" is selected then the contents in cells "C3" AND "D3" are both cleared. Similar is needed for the second row of options;

If Cell "C6" is selected, then the contents in cell "D6" are cleared. If cell "B6" is selected then the contents in cells "C6" AND "D6" are both cleared. Finally, if cell "A3" is selected, then ALL of the above cells' (B3-D3 & B6-D6) contents must be cleared.

View 7 Replies View Related

Clear Contents Of Cells Based On Data Validation Selection

Apr 13, 2012

I am trying to find something that would allow me to have a spreadsheet clear the contents of a certain cell based on the selection made from a data validation list which resides on the same row. This can best be described with an example.

The user selects anything but " " or "none" from the validation list, which for this example resides in C5, would trigger code to clear the contents, if any, in AA5. If " " or "none" is chosen the value remains.

This capability should be available for each row through 100.

View 3 Replies View Related

On Cell Selection, In Named Range, Clear Content Or Add Text If Empty

Jul 24, 2009

I wrote some code that toggles bewtweeen the word "Yes" and the function clearcontents.

What it does not do, is if you click on cell A1 and change it's contents and you click on the same cell again it does nothing. You need to click on another cell say A2 before you can go and change A1 again.

My code is as follows:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub

If Not Intersect(Target, Range("Documents")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
If IsEmpty(Target) Then
Target.Value = "Yes"
Else
Target.ClearContents
End If
Application.EnableEvents = True
On Error Goto 0
End If

End Sub

View 3 Replies View Related

Clear Range Based On Shading?

Dec 26, 2013

I need a macro that will clear the contents of all cells shaded white in range c1:c20.

Clear the contents, leave the cells shaded white.

View 1 Replies View Related

Clear Contents Based Upon Value In Row Range

Jul 21, 2006

I'm trying clear the contents of a column range when the cell above this column range is empty. I know how to do this for one cell, but I would like it to work for a rangefrom R15:BB15.

If IsEmpty(Range("r15")) Then
Range("r16:r35").Select
Selection.ClearContents
End If

End Sub

View 5 Replies View Related

Conditional Clear Based On Other Worksheet Range

Nov 5, 2008

I have a range on worksheet "CONTROL" from S129:S228. There are 100 rows there. I have another range on the active sheet from B17:N116, also 100 rows. If S129 has a value of 1, then I need row 17 on the active sheet to be cleared (columns B-N). And so on all the way to the bottom of the ranges. If it has no value in the cell, then no clearing takes place. So it needs to test the whole range at once. I really have no clue what the variants and ranges should be, and have NO CLUE how to define a variable range so that I can use the value that R is on in the testing cycle to tell the active sheet which row to delete.

View 3 Replies View Related

Clear Contents Of Range Based Upon Values

Dec 17, 2007

There is data(numerical) or blanks in each of the cells in the range H32:O37

I want to clear the contents if they are a duplicate of the previous line.

Looking for a macro hopefully. Found many to delete the whole row but just the specific range based upon the duplicate criteria..As there is data surronding that area do not want to delete whole row just clear that specifc area.

H32:O32 clear contents if same as H31:O31 if any valuse are different then stays the same
H33:O33 clear contents if same as H32:O32 if any valuse are different then stays the same
H34:O34 clear contents if same as H33:O33 if any valuse are different then stays the same
H35:O35 clear contents if same as H34:O34 if any valuse are different then stays the same
H36:O36 clear contents if same as H35:O35 if any valuse are different then stays the same
H37:O37 clear contents if same as H36:O36 if any valuse are different then stays the same

View 9 Replies View Related

How To Select Range And Clear Based On LR Variable

Jul 28, 2008

I want to select and clear a part of a sheet.

here is what I have.

Sub clear_data()
sheets("sheet1").select
lr = activesheet.usedrange.rows.count

Here is where I get lost in translation (syntax).

I want to select starting at Bcolumn through bycolumn but the row be set with the LR from above, since the rows always change.

I could write B2:by2000, but i want to use the LR variable to define the number of rows i have.

View 9 Replies View Related

Copy Or Clear A Range Based On Checkbox

Jan 30, 2008

I am good at excel but an infant with VBA. I have inserted a checkbox onto my worksheet. I want it, when checked, to select a row of data ("k5:k16") from Sheet 1 and copy it to ("a1:a12") in Sheet 5. When the checkbox is unselected, I want the ("a1:a12") to be cleared. I've tried several different ways to copy and continue to run into errors. I know there is a simple solution, but it's beyond me.

View 2 Replies View Related

Clear Cells In A Range Based On Other Cell Values

Jun 6, 2012

I have two rows of numbers, say D1 to F1 and D2 to F2. Row D2 to F2 will always have lower values.

The range below it is D3 to F100. I want the range to clear the contents of the cells in the range where:

a) the cell is > the x1 cell above it

OR b) the cell is < the x2 cell above it

If it is = or between the two cells, the value stays.

Example:

If D1 thru F1 is 4, 5, 7 and D2 thru F2 is 2, 4, 3, then:
D3 is 5, it is cleared
E3 is 4, it stays
F3 is 5, it stays
D4 is 2, it stays
E4 is 1, it is cleared
F4 is 9, it is cleared
Etc

Basically, the cell in the range looks up its own column, compares itself to x1 and x2 in that column. If it's greater than or less than, then it clears the contents, if not, the value in the cell stays.

View 3 Replies View Related

Automatically Clear Range Based On Cell Criteria

Jan 9, 2007

I have the following Worksheet Change Event in my worksheet. The contents of range rng are not cleared.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range

rng = Range("F" & Target.Row & ":M" & Target.Row)

If Not Intersect(Target, Range("N5:N1000")) Is Nothing Then

If Target.Cells.Count = 1 Then

If Target.Value = "Yes" Then

Application.EnableEvents = False

rng.ClearContents

Application.EnableEvents = True

End If

End If

End If
End Sub

View 9 Replies View Related

Print And Clear

Mar 23, 2007

I HAVE JUST PUT THIS CODE TOGETHER

Private Sub printcmd_Click()
Dim lastrow As Integer

Sheets("A").PrintOut

'THEN CLEAR

Sheets("A"). Range("A5:K65536").ClearContents

End Sub

BUT MY PRINTER HAS BROKE AND DONT GET A NEW ONE TILL NEXT WEEK
AND WAS WONDERING IF THIS WOULD PRINT AND THEN CLEAR WHAT WAS ON THE SHEET OR NOT

View 3 Replies View Related

Delete Row Based On Range Selection

Oct 14, 2008

Here is my
ThisWorkbook.sheets("sheet1").Range("M").Select
For Each cell In Selection
If cell.Value = ThisWorkbook.Sheets("Sheet2").Range("A").Value Then
cell.EntireRow.Delete
End If
Next cell
Range("a1").Select
End Sub

I want to remove all rows in sheet 1 that contain any value found in Sheet2 A I using XL 2003.

View 9 Replies View Related

Clear Selection Areas

Jun 10, 2009

I frequently receive workbooks containing up to 50 sheets and on most of them there is a selected area.

Is it possible to put a bit a code in the worbook when opening to clear all selected areas on all sheets.

View 9 Replies View Related

Clear Listbox Selection

Feb 6, 2008

I've got a userform with a listbox, and want to clear the listbox's selection after the user clicks on it (and an operation is performed)

I've tried setting the listindex to -1, but it behaves strangely and calls the listbox_click function again...

Private Sub LocationsAddable_Click()
AddNewLocation (LocationsAddable)
'LocationsAddable.ListIndex = -1
End Sub

with the second line commented, it only runs thru the sub once, but selection not cleared....
if i uncomment the second line, then i get thrown back into this same sub....

View 9 Replies View Related

Copying Rows Based On Range Selection

Aug 27, 2006

I would like to copy selected rows in a range D19:I49 to another sheet, by clicking a button to bring up a User Form containing a List Box, seven Option Buttons (one for each sheet), an OK and Cancel Button. When the User Form is displayed, the required rows are selected in the List Box, then the required sheet is selected via an Option Button. Upon clicking the OK button it pastes (only the values) to the selected sheet, but to the next empty row (if there is already data entered previously) in the same range as above (D19:I49). All seven sheets are identical and are named Monday, Tuesday, etc. to Sunday. If the option button selected is the same as the active sheet a message box could be displayed to ask the user to select another option button and upon clicking the OK button on the message box return the user to the User Form once again so that the correct option button may be selected.

View 2 Replies View Related

Clear Contents Of Dotted Selection

Apr 24, 2014

I'm playing along with Excel. I discovered it doesn't like cutting and pasting in VBA. This screws up formulas in cells.

It much prefers copying and pasting. So this involves an extra step, going back to the cells you just copied and clearing them.

So I have a selection of cells and I just copied them to a different location. Naturally the location I just copied it to then becomes selected.

I would like to go back to the cells that have the dotted selection around them and clear them. If I simply use Selection.ClearContents it will clear the currently selected cells, NOT the dotted selection.

Command to clear the contents of the dotted selection?

View 4 Replies View Related

Print Area Range Based Upon Formula

Feb 26, 2012

I am trying to dynamically set a print area based upon a formula from the contents of 2 cells. What I need is the print area range to be C1 to Ix, where x is the result of ((A2/B2)+2).

View 2 Replies View Related

Clear Background Color Before Print

Jun 12, 2007

I have a excel file wherein background color as well as conditional formatting background color is used. However, since printout consumes huge ink for those sheets, i want that before print the code will clear all the background color (done through Fill color & conditional formatting color) and after the print activity, restore those color. the colors are given to faciliate data entry and better presentation.i have recorded the same but background is not restored when I run the code And also sometimes the code doesnot start printing.

View 4 Replies View Related

Macro To Clear Contents In Every Other Cell Of A Selection

Apr 25, 2008

I need to clear the contents of every other cell in a selection of 5000 rows starting with the first cell. Is there a macro that can do this for me?

View 3 Replies View Related

Automating The Number Of Copies To Print Based On A Range

Dec 11, 2008

Automating the Number of copies to print based on a range. ihave the following

View 3 Replies View Related

Clear And Print Tabs In A Worksheet With Checkboxes

Feb 4, 2009

I have a workbook with 100 tabs and I have an index page with checkboxes for each tab. I need a macro that will clear all of the checkboxes on the page with one button and a separate macro that will print only the checked tabs.

Can anyone write that code for me so I can just add it into my index tab?

View 6 Replies View Related

Macro: Print Sheet & Clear All But Heading

Nov 13, 2006

is their away to print a sheet/s and after printing to delete the contents but still leave a title

View 9 Replies View Related

Populate Cells Based On Date And Time Range Selection?

Mar 10, 2014

Is it possible to be able to select a range of dates, and a time interval, and then to automatically fill in cells in a column? to be more specific, I want to be able to select, say 1 Jan 2013 to 31 dec 2013 in one box, then specify a time interval, for example "hourly" and then a column is populated with each interval, i.e. 1 jan 2013 00:00, and then the next one is 1 jan 2013 01:00 etc. I have tired the normal automatic fill tool but it never seems to get it right. It works for the first few days then it all goes funny.

View 3 Replies View Related

Variable Column Range Based On Current Selection For Sorting Columns

May 16, 2014

The first line of the code chooses the columns to select; all columns until there is no value. From there I need to have it sort those columns based on row 1. The problem is that the columns chosen are variable. It could be columns I:N (as shown below) or column G:Z or any other combination. (The code below was recorded if that matters at all.)

View 2 Replies View Related

Completing Range Of Cells Based On Data On Another Sheet Prompted By Dropdown Selection

Mar 23, 2014

First sheet has a client name and several cells of data along the same line. All of the data on this sheet is kept long term.

The second sheet is completed copied and deleted. In completing the second sheet the client name is selected of a drop down list and pulled from sheet one.

What I want to do and not sure if there is a way is that when I select a client and populate it on sheet two I would like the related data on that clients line from sheet one to populate to same named lines on sheet two.

if this is possible and if so provide a brief description of how it would work

View 3 Replies View Related

How To Print A Selection To PDF

Apr 9, 2013

I've attached a sheet. In this sheet I would like to print the selection....C9:17 and BL9:BW17. I would like to print it onto a PDF and I would like to expand it so it is very visible. Actually, it doesn't need to be PDF. If I could just print this selection and make it visible that would work. I had a problem using print selection because the columns are separated. I also tried fit to page but that makes it too small.Mod's note: file attachment removed at OP's request

View 2 Replies View Related

How To Clear Contents Of Clipboard Before Tool Takes Screen Print In Excel VBA

Apr 20, 2014

I've have a tool/code that takes the screen prints of the active window (when I press F9) and pastes it in a word document.

But whenever I do copy some text or any other image and when I press F9 to take the screen print of the active window. I get the text pasted into the word, this is because the clipboard content has text first and then the screen print of the active window.

Instead When I press F9, I wanted the below to happen

1. Content from the Clipboard should be cleared

2. Take the screen print

3. Paste it in the word document.

Note: My tool/code already does 2 and 3. Looking for 1 alone, ,

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved