Trying To Create Macro That Selects A Ceiling And A Floor

Jan 31, 2008

I am trying to write a macro, but am failing at it.

Basically, what I am trying to do is:

----------------------

Select a whole row, for example 5
Define that row as "Ceiling"

Then select a row a few steps down, for example 18
Define that row as "Floor"

Then select the range (ceiling, floor)

Then print that area.
-----------------------

But I have no idea how to write the code.

View 9 Replies


ADVERTISEMENT

Ceiling & Floor Together

Sep 25, 2007

1. If column D422 is greater then 9,750 then multiply D422 by 10% and then floor it to the nearest 100. But what I am trying to do is;

If D422 is between 9,750 and 9,999 then multiply it by 10% then ceiling it to the nearest 100 which would be 1,000. But if it is equal to or greater the 10,000 then multiply it by 10% then floor it to the nearest 100. So the minimum 10% returned should be 1,000.

=IF(D422,FLOOR(D422*10%,100),9750)

View 9 Replies View Related

FLOOR And CEILING Functions

Oct 9, 2009

Say i got a figure 9.9218. If written "=floor(9.9218,0.0625)", the result i would get is 9.875. However, if the formula was written with the CEILING function, I would get 9.9375.

Now here's the fun part. Is it possible to combine the FLOOR and CEILING function codes into one complete function, where it could determine whether 9.9218 is closer to 9.9375 than 9.875?

The following was taken from my decimal equivalent chart, at spaces of .0156:

.875
.8906
.9062
.9218
.9375

*As seen here, .9218 is closer to .9375

View 5 Replies View Related

Price Calculation With Floor And Ceiling

Jul 20, 2007

I have the following calculation that I use to determine if a price is outside of a floor or ceiling, if it is outside of the range it uses either the floor or ceiling price

=IF($G$76E76,-(($G$76-E76)*F13),0))

the formula is in cell G71
F13 is the total quantity
E76 is the ceiling price of $15.00
F76 is the floor price of $7.50
G76 is the calculated price of ($6.21)

In this case the floor of $7.50

I would like to modify the formula to where if you input N/A (or something else) that it will give a result of $0. I do not want to put a zero in the cells for the floor and ceiling price because it will give me a result of $0.

View 9 Replies View Related

Ceiling, Round And Floor Functions

May 7, 2007

I have a value in a cell that is to one decimal place. I need to round this value to the nearest 0.5 multiple up or down which ever is closer. The value in cell A1 reads 6.6, therefore rounding I want the cell to read 6.5 If the value in A1 is closer to 6 say 6.2 I want the cell to read 6.0

View 5 Replies View Related

Create Function To Selects Data From ABC Column And Put Into New Columns For Each Step

Mar 3, 2012

Is this possible? If

A B C
0 0 0
0 0 0
1 4 5
2 4 8
0 0 0
0 0 0
0 0 0
2 6 9
8 9 3
3 5 6
0 0 0

In the raw data, the 0s split up the data into different steps. I am trying to create a function that selects the data from the ABC column and puts it into new columns for each step. I.e:

New Columns with:
1 4 5
2 4 8

and
2 6 9
8 9 3
3 5 6

In the raw data files, there will be 10 steps, with a varying length of data.

View 2 Replies View Related

Excel 2003 :: Macro To Open Folder Then User Selects File Then Macro Continues To Run

Nov 6, 2011

I use Excel 2003 at work. I'm looking for some code that will Open a folder and then lets the user to select a file then continues to run the macro.

The file name they select will look similar to this K2271011.504 or K3011111.201

View 3 Replies View Related

FLOOR Function In UDF

Dec 20, 2006

I am trying to ask if a truncated number is divisable by 9. e.g. 1234 truncated would be 123. To truncate the number i've tried to devide it by ten and then round it down using the floor or rounddown function. However i get the "Complie Error Sub Or Function Not Defined" error in my User Defined Function

If Floor((i / 10), 1) Mod 9 = 0 Then
Do my groove thang
End If

The compiler is IDing Floor (or rounddown) as the problem.

View 2 Replies View Related

Rounding / Ceiling

Sep 24, 2008

I have a set of numbers that I need to round up to the nearest number divisible by 5. For Example...

28 would be 30
-13 would be -10

There is one additional part though. If the number is already divisible by 5 I need it rounded to the next number. For Example:

0 would be 5
-10 would be -5
10 would be 15

View 9 Replies View Related

Case-dependent Ceiling

May 1, 2009

I have to multiply a value X by 20, then depending on the Case = ProteinA or Case Else, round up to the next multiple of 100 or 500.

If Case = ProteinA, I want that 20*x to be rounded up to the next 500.
If Case else, then I want the next multiple of 100.

View 9 Replies View Related

TextBox Overflow When Using Ceiling Function

Apr 18, 2006

I've got a UserForm with a bunch of TextBoxes on which the user is inputting numerical values into.

After any entry a macro is rounding the value to the nearest multiple of 25 using application.worksheetfunctionceiling/floor functionality.

I've got a problem that as the value in the textbox approaches 33,000 I get an overflow error message. (I'm presuming at 32 bits)

View 4 Replies View Related

Variables- Spreadsheet That Calculates The Floor Area Of A New Build City Centre Hotel

Apr 3, 2009

heres the data: [url]

Im meant to produce a simple spreadsheet that calculates the floor area of a new build city centre hotel. The developer is looking at various plots of land that allow differing sizes of floor plates and storey heights. The key variables are the number and type of bedrooms, number of floors and whether the hotel is classed as a premium or budget hotel.

I need to produce a spreadsheet that shows the key variables and the total calculated floor area at the top of the sheet.

View 14 Replies View Related

More Than One Case Selects

Feb 17, 2012

Is there a way to do multiple case selects. For example if I have A3=2012 and A4=COMPANY NAME do this. I don't want to use if and for this because I have several company names in this list and think case would be easier. So far I have the following attached code but this pastespecial should only occur if the value of A3=2012 as well.

Code:
Select Case Cells(i, 1).Value
Case "COMPANY NAME"
Range(Range("B" & i), Range("E" & i)).Copy
Sheets("Abbott Label").Select
Range("b45").PasteSpecial

View 9 Replies View Related

Dropdown List That Selects Corresponding Value Instead?

Jul 3, 2014

i am trying to set up a data validation list for the user to select the options from the 'reason' column' but the input in the box would be the 'code' corresponding to the reason

i.e drop down list would show me the' reasons' but when selected it would input the 'Code' only

View 14 Replies View Related

Create Macro That Can Create Dynamic Copy / Paste Loop?

Feb 12, 2014

I need to create a macro that can create a dynamic copy/paste loop. So far what I have is horribly inefficient. Each row in colmn A(minus the header) has a unique number in it. For each unique number, I need to paste it based on the number of column headers in row 1(minus column A). So, if there are 20 column headers, I need to copy cell A2 and paste it 19 times in another sheet. Then, I need to move to the next number in column A and do the same thing. Here's what I have:

[Code] .........

You can see that this is not dynamic. If I add another row to my table and rerun the macro, it will not catch it. I've attached a sample file to show you the big picture of what I'm trying to do. The data that I have is in Sheet1, and I'm trying to get it into the format in Sheet3. Rows/columns will be periodically added to the table in Sheet1, so the macro needs to be dynamic to catch that. The data in Sheet3 will always remain, and the macro will add the updated data below the old data in Sheet3.

FC_Macro_Sample.xlsm

View 8 Replies View Related

Autofilters A Range And Selects The Data

Jan 25, 2009

I have this code below which autofilters a range and selects the data i need, there is also a small offset part that leaves the active cell as the one in the top lef of the needed data. I also have the row count of the data in cell G1. What I need to do is something along the lines of:

View 3 Replies View Related

Sum The Cells In B According To What The User Selects From The Drop Down

Oct 8, 2009

Say you have two columns, A & B. Each cell in column A consists of an identical drop-down menu of four possible choices. Each cell in B is a random number. I want to sum the cells in B according to what the user selects from the drop down in column A. If A1=A2="BILL", I want the sheet to add B1 and B2. IF A1=A3="BILL", and A2=A4=TOM, I want the sheet to sum B1 and B3, then sum A2 and A4. So, conceptually, I guess column A acts as a group identifier, and I want to sum B by group.

View 2 Replies View Related

VBA - Selects Data From Column Only For Analysis?

Sep 16, 2013

Each month we receive an updated budget which includes info for every month of the budget year. I want the user to be able to select the column (which relates to a month) that they want to use for the analysis. I will use the data in this column only for analysis. How can I do that?

View 3 Replies View Related

Checkbox That Selects Multiple Checkboxes

Aug 9, 2007

I have a worksheet with approx. 100 form checkboxes. The cell behind each box holds it's TRUE/FALSE condition, which is something I check for elsewhere on another worksheet.

I need one 'SELECT ALL' checkbox which, when selected, will 'check' every one of these 100 checkboxes (change their conditions to TRUE).

Ideally this would be done thru an excel formula, but I've looked everwhere and not found anything that will permit this.

View 6 Replies View Related

For Next Loop: Selects The Cell And Inserts The Formula

Feb 4, 2009

i am trying to do something along the lines of. a For Next Loop that selects the cell N6 and inserts the formula.

$K$7*F6+$L$7
then fill down to the cell N754
then selects O6 and inserts the formula
$K$8*F6+$L$8
then fill down to cell O754. repeating this until there are no more values in either the K or L column. in the attatched spreadsheet i have deleted the values from 50 something down to 754 but the idea is still the same.

so that each formula inserted keeps the cell from column K and L constant when filled down but F changes, then when the next column is used(ie. from column N to O), the next row in the K and L is used but F starts from F6 and changes as it is filled down again.

View 5 Replies View Related

Define When A User Selects Specific Multiple Cells

Nov 24, 2008

My worksheet with macros gets messed up when a user selects either multiple cells from column F or selects multiple cells in any one row (but only if column F is included) in the range C17:O116 and hits "delete". I will either do an exit sub, an application.redo, or something similar so that this doesn't happen, but I don't know how to write the code to trigger these events. So I need a way to determine "if the user selects multiple cells in column F and hits delete" or "if a user selects multiple cells in any row from 17 to 116 that includes the cell in row F, and hits "delete.""

Set Rng = Range("F17:F116")
Set rng2 = Range("K17:K116")
Set Rng3 = Range("L17:L116")

View 3 Replies View Related

Paste Date And Time When User Selects From Dropdown

Nov 29, 2011

The code below adds the date to D:D once the user enters data in B:B and then adds the time when the user selects from a dropdown in C:C. When they have finished the task they enter anything into F:F and then it enters the end time in G:G.

This works well except for one flaw and one modification that I can't get to work. I have found that people retrospectively change the activity in C:C which causes the start time to change. I would like to avoid this hapenning if possible by putting some code in to stop this. Also I would like the times to be related to the push of a button on the sheet and therefore need different code.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("B2:B900")) Is Nothing Then
With Target(1, 3)
.Value = Date

[Code] ......

View 3 Replies View Related

Mouse Click Selects Wrong Listbox Item

Oct 2, 2013

A list box selection works fine on my computer but on a friends Windows Vista PC the following happens:

Selecting items near the top of the list works fine. 1/4 of way down a mouse click on an item selects the Next item.
1/2 of the way down in the list, the mouse click on an item selects the one 2 or 3 further down, etc., etc.

View 1 Replies View Related

ActivatE Calendar When A User Selects A Specific Cell

Jan 29, 2009

I'm wondering if someone can help me with this. I am using the excel calendar control and trying to activate it when a user selects a specific cell "C3". I can get it to activate when I move off the cell, but it's not working when they click on the cell.

Sheet1
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C3")) Then
Call OpenCalendar
MsgBox "Calendar"
End If
End Sub

Userform2 (I have this code under here)...............................

View 9 Replies View Related

Populate Master Sheet Based On Dropdown Selection That Selects Other?

May 2, 2014

For example, I have a master sheet that has a drop-down list of the months January and February, which have their own sheets. I am trying to populate the sales of the week 1, 2 ,3 ,4 in the master sheet based on the same data for the month chosen.

View 2 Replies View Related

Ensure User Selects Radio Button Before Adding Information

May 27, 2014

I have a userform for inputting information to a spreadsheet using the code below. It works fine however if the user does not select a radio button to select a score its saving the rest without it. How can I ensure the user selects a score,,,, ob10, ob8, ob6, ob4, ob2, obna.

[Code] ......

View 2 Replies View Related

Sheets Object Syntax - Selects Cell In Each Sheet Within The Book

Aug 26, 2012

I'm trying to write a macro that selects cell A1 in each sheet within the book. I've written the following code:

Code:
Sub a1()
For i = 1 To Sheets.Count
Sheets(i).Cells(1, 1).Select
Next i
Sheets(1).Select
End Sub

However, it produce this message: "Run-time error '1004': Select method of Range class failed."

If I slightly modify the code to

Code:
Sub a1()
For i = 1 To Sheets.Count
Sheets(i).Select
Cells(1, 1).Select
Next i
Sheets(1).Select
End Sub

It works fine. I'm curious why this happens.

View 6 Replies View Related

Nesting Ceiling Function In IF Function - Conditional Formatting?

May 13, 2013

I am trying to nest an IF function with a CEILING function. If C10 is < 3.5, make it 3.5, however, if C10 > 3.5, CEILING (C10, 5)

right now it looks like:

If (C10

View 1 Replies View Related

Create Macro Button And Assigning Macro Code

Aug 10, 2014

Refer to attached file.

I have below code which successfully create a macro button and assign the macro correctly.

This is only doing for one sheet and i need to modify the code so that it does for all sheets of the workbook.

[Code] ....

Test Macro_Botton.xlsm‎

View 3 Replies View Related

Excel 2007 :: Clicking On Cell Auto-selects Cell Next To It - Cannot Disable

Nov 16, 2010

Whenever she clicks on a cell, the cell to the right of it is also selected. When she tries using tab to move to a new cell, she can only move between the two selected cells. Same with using the enter key. As such, it is extremely difficult for her to modify only one cell, since she always has two selected.

The F8 key, as well as Ctrl+F8. However, pressing the F8 key only adds more cells to the autoselection, and Ctrl+F8 allows her to select one cell, but also highlights the cells around it, and when we tried to select other cells, every cell we clicked stayed highlighted.

Additionally, sometimes when she clicks a cell, it will just select that one cell. Click it again, and the problem is back. I haven't been able to determine any patterns to this behavior, and I know there is no problem with the input (the keyboard and mouse are standard-issue in our lab, and we keep them well maintained).

View 8 Replies View Related







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