Sequentially Filling Fuel Tanks Using VBA
Apr 29, 2006
I am trying to get the following code to work. The instructions of at least one (but only one) of the following "IF" statements should always be run. It runs but does not produce correct results. I believe my logic is correct but the proper code is lacking! I have attached an easy to follow worksheet
Sub Max_Fuel()
If (26850 - E18) <= 1554 Then
Range("e19:h19") = (26850 - E18)
End If
If (26850 - E18) <= 4234 Then
Range("e19:h19") = "1554"
Range("e20:h20") = (26850 - E18 - 1554)
End If
If (26850 - E18) > 4234 Then
Range("e19:h19") = "1554"
Range("e20:h20") = "2680"
Range("e21:h21") = 26850 - E18 - 4234
End If
End Sub
View 5 Replies
ADVERTISEMENT
May 22, 2014
I am trying to write a formula that will count rows. The hard part is when the project is cancelled I have the formula written to not count that row. However, I want the next valid row to be numbered sequentially. Here is the formula I have:
=IF($B2="","",IF($Q2="YES","",ROW($A1)))
So I want it to be numbered 1,2,3...., not 1,3,4.
View 9 Replies
View Related
May 19, 2008
We have these worksheets that have 100 tabs each
each tab is named joel_1400, joel_1401...Joel_1499 insert data in each tab template as needed for RFI's. then we have to make another worksheet with 100 tabs for 1500 to 1599
what we are doing is copying the whole worksheet and then erasing all of the user fields and changing all of the names manually for each tab
View 14 Replies
View Related
Feb 22, 2010
I'd like to do is to use loops to copy each value in "Sheet1" into every other row in column B of "Sheet2" starting on row 16. I realize that this is a simple task, but I'd like to know how to do this for the purposes of learning the correct VBA coding.
View 7 Replies
View Related
Jul 27, 2009
I have a spreadsheet with a column of data that is similar for a while, then changes, is similar, then changes. I need to number them as each set of data changes, how can I go about that?
Here is an example of what I have:
Dog
Dog
Dog
Cat
Cat
Bird
Bird
Bird
Bird
Lion
Elephant
Elephant.....................
View 5 Replies
View Related
May 2, 2013
Suppose I'm a grocer and I use a spreadsheet to track my inventory. I sell fruits, vegetables, and dried spices. On one worksheet in my Excel file, I create the following lists:
FRUITS
VEGETABLES
Apple
Potato
Orange
Celery
[Code]...
Then on a second worksheet, I have my actual inventory, which is this:
ITEM
QNTY
PRICE
CLASSIFICATION
[Code]...
I need a formula for the "Classification" cells of the Inventory. For each "Classification" cell, I want the formula to do the following: Search for the corresponding "Item" in the "Fruits" list; if found, then put "FRUIT" in the Classification field.If not found, search for the corresponding "Item" in the "Vegetables" list; if found, then put "VEGETABLE" in the Classification field.If still not found, put "SPICES" in the Classification field.
So using my toy example:
The formula for the first row would search for "Banana" in the "Fruits" list. Because the desired text sting is found, the formula enters "FRUIT" into the Classification field.The formula for the next row would search for "Cucumber" in the "Fruits" list. It would fail to find it, so then it would next search the "Vegetables" list. Because the desired text sting is found there, the formula enters "VEGETABLE" into the Classification field.The formula for the next row would search for "Dried Oregano" in the "Fruits" list. It would fail to find it, so then it would next search the "Vegetables" list. Because the desired text sting is not found there, the formula enters "SPICES" into the Classification field.
If Excel can handle this level of automation, but I suspect there must be a way to do this.
View 2 Replies
View Related
Oct 2, 2008
I am trying to work out how I can assign a sequential value to sets of duplicate data within a list. i.e. where I have duplicates in a list I want each of the duplicates (that are in the same set) to have a sequential number assigned and for that to start from 1 each time it discovers a new set of duplicates.
RED
GREEN
YELLOW
PURPLE
RED
ORANGE
BLACK
GREEN
RED
Where a colour is duplicated in the list I want it to have a sequential number assigned. When a new set of duplicates is found the numbering starts from 1 and sequentially increases. So the above data list would resulting in the following output
RED 1
GREEN 1
YELLOW
PURPLE
RED 2
ORANGE
BLACK
GREEN 2
RED 3
Have tried variations of the RANK function, but not sure how to get the sequential nu,bering to restart with each unique set of duplicates. I would also like to do this without VBA if possible using the built in functions.
View 8 Replies
View Related
Feb 7, 2014
I have a column of week numbers but some gaps in the list (e.g. the job is complete and so I do not want to reference it) I am trying to create a list of jobs by week number. I need to sequentially number jobs to then use Vlookup e.g. job1-week1 job2-week1 etc to display be week.
I can work out to number the list ignoring the blanks but then resetting to 1 with each new week?
Workbook1.xlsx
View 2 Replies
View Related
Aug 1, 2009
I have built a complex vba & multisheet spreadsheet that I am looking to secure against all the common attacks. So I have:A Workbook Open pw;
VBA password (29 symbols/numbers/Caps/lower case)
Very Hidden worksheets
Hidden rows/columns
Restricted scroll areas
Workbook protection
Code that auto protects all sheets upon opening
Registry referencing in Workbook Open with timed closure if not matched
Now I am on the last leg of implementing protection against Application.EnableEvents = False; force enabling of Macros and hiding of toolbars, scrollbars etc... Phew.
Soooo, in my research, I have learnt that if EnableEvents = False, Workbook_Open is essentially skipped and the security VBA routines are disabled. To get around, I have copied the entire contents of the Workbook_Open routine to a module under Auto_Open. The first line of both these scripts is: Application.EnableEvents = True.
Works! So far so good.
However, I have a Msgbox prompt in the scripts that displays twice. So in essence, Excel is running Workbook Open first, then Auto Open second.
If I open another instance of Excel and run Application.EnableEvents = False first before opening my spreadsheet, I only get one message. So only the Auto Open script runs.
View 9 Replies
View Related
Feb 28, 2008
how many accounts, and list the total on the bottom.
So, I have something like this:
10003722
10003722
10003722
10003722
10008981
10008981
10008981
10008981
10008981
10028163
10034527
I need the column next to it to show #1 next to 10003722 than jump to the next one and have 2 next to 10008981 and so on...
View 5 Replies
View Related
Mar 22, 2012
I would like to have a sheet where there is a cell designated as "start number" (where any number may be entered) and a cell designated as "how many times". I would then like to be able to click a button and excel generates a list of sequential numbers starting from the number designated in the "start number" cell as many times as is designated in the "how many times" cell.
View 2 Replies
View Related
Mar 17, 2008
I need to lookup data based on a cells content. The answer has to output to a table as a sequential list. I have attached a sample workbook (there will be 100+ sheets in the final version!). The Register sheet lists competencies against page# and title. For each Evidence Sheet I need to populate the Competency grid (C4:D10) in a sequential manner i.e. no blank lines,and the Title (B13) based on the Page # (D2). I have looked at a great number of postings, but cannot see a solution that fits.
View 7 Replies
View Related
Jun 3, 2008
Is it possible to autonumber records created with data entered with a user form?
If it is possible - I would also like to know how I could display the current record number on the data entry form....
View 3 Replies
View Related
Feb 6, 2013
I have a workbook with a series of worksheets with stock lists and pricing that I would like a user to be able to select items on (say, with a checkbox) that would then automatically populate a separate master Order Form sheet. The Order Form sheet is currently blank, with headers, and I would like only those items selected on the various stock sheets to be displayed on the Order Form.
View 4 Replies
View Related
Feb 18, 2014
I have data from (row 1, column 1) to (row 53, column 5) on 283 consecutive worksheets in a singular excel file that I would like to be presented on a singular worksheet starting from the data on worksheet 1 and descending to the data on worksheet 283.
I am looking for a copy and paste loop solution that will copy the data from each page and sequentially paste the results on a singular output page in descending order (worksheet 1 data, worksheet 2 data... etc) so that I can sort the data.
View 1 Replies
View Related
Feb 14, 2010
I’m not even sure I can do this- but- I want to be able to have a few columns, 3 of them I want to be Item #, Item, Cost.
Is there a way to put the Item # (Number) in, then have the other 2 automatically come up?
View 9 Replies
View Related
Jan 18, 2013
I have a table of information on a worksheet and one of the columns determines whether the item in that row is active (there will be active and inactive items in this "Main List")
On a seperate worksheet (in the same file) I want to only display the active items in a new table (Overview) and always ensure it has no empy spaces other than at the bottom of the list, so if row 1/2 in the Main List are inactive items then the first row in the Overview List would display row 3 from the Main List.
Ideally I would rather do it in a formula than VB if possible.
I've attached a file showing what I am trying to explain, where the Overview tab currently has the data typed in it should automatically populate based on column "I" on the MainList tab.
example.xls
View 2 Replies
View Related
Sep 25, 2007
I want to be able to have a macro that will compare one cell to the rest of the cells in a collum. I have used the COUNTIF() formula and it's getting on my nerves a bit because it seems as though everytime i sort the data, it totally messes up the formula (as in it changes the cell refernces to seemingly randomly generated numbers, but that is a different matter! lol). here is the formula, and it will be followed by the formula that is in the cell directly below it: =COUNTIF(F2:F65536, F2) and the one below it: =COUNTIF(F2:F65536, F3). Only one number needs to change, but when i fill down in excell, it wants to add one to every number, even when i click COPY cells... oh well. So i want to write this macro that will do just that. That way, it has fixed reference parameters e.g. F2:F65536, and one variable parameter e.g. F2, F3, F4 and so on. I'm not too savvy with this whole VBA stuff... the university insisted that everyone uses C++ nowadays, lol. I would like this macro to output its data into an adjacent cell ex. if F2 was compared, the data will be placed in H2.
View 10 Replies
View Related
Aug 3, 2009
I m looking to fill down a column where I am assigning a number that maps to a certain week of the year. In essence after every 7th value the number should increment by 1.
Date Day ConsumptionWeek number
1/01/2009Thu 827 1
2/01/2009Fri 907 1
3/01/2009Sat 1,013 1
4/01/2009Sun 1,051
5/01/2009Mon 1,097
6/01/2009Tue 1,155
7/01/2009Wed 1,044
8/01/2009Thu 976 2
9/01/2009Fri 1,034 2
10/01/2009Sat 1,107
11/01/2009Sun 1,073
12/01/2009Mon 1,161
13/01/2009Tue 1,395
14/01/2009Wed 1,172
15/01/2009Thu 1,060
16/01/2009Fri 1,008
View 5 Replies
View Related
May 1, 2009
I fill mentioned data by Qty values in Sheet2?
Sheet1
ABCDE1NameLogQtyCodeZop2A140005RFG-13B150001RFG-14C980003RTH-1
Excel tables to the web >> Excel Jeanie HTML 4
Required result like this.
Sheet2
ABCD1NameLogCodeZop2A14000RFG-13A14001RFG-14A14002RFG-15A14003RFG-16A14004RFG-17B15000RFG-18C98000RTH-19C98001RTH-110C98002RTH-1
Excel tables to the web >> Excel Jeanie HTML 4
View 9 Replies
View Related
Nov 12, 2009
im filling out a worksheet.
on the rows i have this data ex. (123467.00) is there a way i can format the cell so the final product is this ex. (1234.67).
i've tried may things but what i get is (123467)
i have multiple worksheets like this just want something that can do automatically instead of manually.
View 9 Replies
View Related
Feb 24, 2010
How can you fill up a listbox on a form with data from a couple of cells.
For example you have the worksheet Colors and you have these values in the cells of column A
A1 = red
A2 = yellow
A3 = blue
Now I want red, yellow and blue to be in the Listbox.
View 9 Replies
View Related
Sep 26, 2006
In my worksheet I have a column with the number 1 in cell G3 ,I want to fill down the column with the number 1 as far as there are rows that have text in them. How do I tell Excel to fill down only as far down as the end of my table.
I would like to run this in a macro.
View 3 Replies
View Related
Jan 31, 2007
I have searched the site but cannot find an appropriate solution. I have a list of names in column a, some of the names are repeated if the name is repeated then at each occurence of the name I would like a '1' to be placed next to it in column B.
I am trying to adapt the conditional formatting formula:
= COUNTIF($A$1:$A$25,$A1)>1 and then I guess I need to add a '1' else ' null' command but I just can't seem to get the syntax correct.
View 9 Replies
View Related
Jul 22, 2014
I have a workbook where one worksheet is referencing cells from another worksheet. I need every third cell to pull from every single cell on the other sheet.
I have found on other threads that =INDEX('WORKSHEET!B:B, 1*(ROW($B$4:$B$4)+1)) worked. However when I filled down it wont increase the row reference.
ie.
=INDEX('WORKSHEET!B:B, 1*(ROW($B$4:$B$4)+1))
=INDEX('WORKSHEET!B:B, 1*(ROW($B$4:$B$4)+2))
=INDEX('WORKSHEET!B:B, 1*(ROW($B$4:$B$4)+3))
[ATTACH]334142[/ATTACH
The other threads mentioned it should fill down fine, but not working for me.
View 4 Replies
View Related
Jul 22, 2009
I'm working on some data dealing with time fields, and I need to have them counted in 15 minute intervals.
For example, one of the entries listed in a column has an event starting at 02:25:00 and ending at 02:55:00 (30 minutes). Along the top row are times listed in 15-minute intervals, e.g. 13:00:00, 13:15:00, 13:30:00, etc. In the corresponding cells, if the entry took place within a particular interval, I need it to say "1", otherwise have it say "0" or "-" or something denoting no event.
An IF statement was used, but it didn't seem to work.
If that's a little hard to follow, check the example attachment for a better idea of what I'm trying to describe.
In the example spreadsheet, Row 2 (manually typed in) is what I'm looking for. Row 3 is the (failed) attempt to use the IF statement.
View 14 Replies
View Related
Oct 13, 2009
I have to validate cell text are (1, Absent, 2,leave, 3 present, 4 late 5 no report)
at the same time Absent should filled by, red leave by pink, present by green, late by yellow and no report by blue.
Preferably I dont want to use VBA. I am using excel 2007 but I am not excel expert.
View 7 Replies
View Related
Dec 9, 2012
Not sure if this can or would be done in vlookp??. In my example the print page needs to get data from a list where people set.
View 3 Replies
View Related
Oct 30, 2013
I am working on an inventory sheet. Its probably only complex due to the amount of data. There are several hundred locations we service and these are in a single column, and then there is the equipment we use that is several hundred columns.
Each location uses 3 rows and the 1st needs the formula to equal 2 rows beneath it. i.e. cell E28 has the formula =E30. I basically need to fill down, but only put that formula into every 3rd row, as the two rows beneath this row need to stay blank, or show number i manually put into either.
The second part of this, is there a way once that is done, to just select those cells, and fill to the right all the way? Again, i do not need to fill the two rows under that one.
I have attached part of the sheet .....
The green cells are the ones that need the formula, and those will be copied down, and right. the others need to be left alone. I have been sitting here for an hour manually entering in the =XXX for each cell.
View 4 Replies
View Related
Feb 17, 2014
I got a list with numbers on Sheet"Bookings"
8000
8001
8002
and so on.
When i fill in a name like commission on Sheet1"Freshbooks"
The number 8000 must be connected with that ..so that it will appear on my last sheet "Ouput"
So to summ it up Sheet1 I fill in commision on table H the number 8000 must apear on sheet"output"
Is this possible in a Formule or in a VBA line???
View 1 Replies
View Related