Condense Code To Make More Efficient And Run Until Blank Cell

Apr 10, 2014

Any way of shortening the attached code. The first part 'Sub Loop1()' works great but I can't figure out how to shorten the second part. As you can see the distance between columns is always consistent i.e. add 5 columns to find the next outcome to work out the next result. Ideally I wanted to somehow loop through the next 5 columns again and again until the cell is blank.

[Code] ......

View 2 Replies


ADVERTISEMENT

Make Copy / Paste Values Macro More Efficient When Calculating

Feb 17, 2014

I got a macro to copy and paste values onto another tab within my worksheet. I have a lot of data and currently takes about 30 seconds to calculate and paste. Not sure if its an issue with my macro or with my computer (Mac - Excel 2011).

Here is an example of my macro:

Sub SimulateWeek()
If Range("AdvanceWeek").Value = "Week 1" Then
Range("Week1B").Copy
Sheets("Schedule - Results").Range("C2").PasteSpecial Paste:=xlPasteValues

[Code]....

(this continues on until 'ElseIf Range("AdvanceWeek").Value = "Week 31"....etc). So you can see I have the same code repeated 31 times.

View 2 Replies View Related

Efficient VBA Code Vs Macro Recorder Code

Sep 9, 2007

What is the most efficient VBA code for the following macro recorded codes? I wish to write more efficient code versus the lengthy, cumbersome macro recorder code.

1) Macro Recorder Code to Copy One Sheet to Another

Sheets("Data Apple").Select
Cells.Select
Selection.Copy
Sheets("Banana").Select
Cells.Select
ActiveSheet.Paste

2) Macro Recorder Code for Replacement Purposes......................

View 9 Replies View Related

Making Code Efficient

Dec 29, 2009

following code be write down in more efficient manner :>>>

Range("B3") = Range("L" & Target.Row)
Range("C3") = Range("O" & Target.Row)
Range("D3") = Range("Q" & Target.Row)
Range("E3") = Range("R" & Target.Row)

View 9 Replies View Related

Code For Efficient Format

Feb 23, 2007

Was hoping to get some help with a mini project of mine.. Currently I am looking to create a progress/commission report (pull data from an access dbase) and populating an excel sheet. I can manage to pull in the data fine its just gettting into a format that is the complicated thing. I was hoping that someone might have a few moment to pick thru my code (see attached) and maybe suggest an alternative/more efficent way to do the refreshing.

View 5 Replies View Related

Efficient Code To Map Cells From One File To Another

Oct 21, 2006

Is there a way to make the code below more efficient?

My data resides in "Buildings August 2006(2).xls " and I wish to copy some cells to "Backlog Analysis .xls"

'Copy J16 to B5
Windows("Buildings August 2006 (2).xls").Activate
Range("J16").Copy
Windows("Backlog Analysis.xls").Activate
Range("B5").PasteSpecial

I repeat the code above 7 more times to handle J29-B6, J33-B7, J42-B8, L56-B10, L57-B11, L60-B13 and L62-B14.

Is there an Array I can use to encompass all of the copy and paste commands?

This is step 1 of something I am doing for work

Step 2 will be to figure out how to work my way through all of the worksheets in "Buildings August 2006(2). I have seen numerous code examples for this so I think it shouldn't be too hard.

View 5 Replies View Related

Trying To Move My VBA Programming To The Next Level And Use More Efficient Code

Oct 18, 2007

I'm trying to move my VBA programming to the next level and use more efficient code.

I'm wondering if there is a faster way to run the loop below, perhaps removing the 'For c = 2 to LastRow' as it seems a little clunky to me.

For c = 2 to LastRow

If Cells(c, Range("Product_Type").Column) = "" Then _
Cells(c, Range("Product_Type").Column).Interior.ColorIndex = 41

Next c
I've seen a similar thing somewhere where it was all done in one statement without the loop.

View 9 Replies View Related

Efficient Loop Code To Format Labels

Feb 18, 2009

I am trying to creat a code that with take the value of an active cell and depending on this value will assign a backcolour to a label corresponding to the cell. so far so good.
I then want the code to offset to the next cell in the range read its value and assign a colour to that cells backcolor.

here is an idea.

range("A1").select
for n = 1 to 4
if activecell = "A" then
Label1.BackColor = RGB(0, 0, 0)
else
if activecell = "B" then
Label1.BackColor = RGB(0, 0, 255)
else
if activecell = "C" then
Label1.BackColor = RGB(0, 255, 0)
end if
activecell.offset(0,1).select
next n

Firstly I would like the next loop (refering to A2 in this example) to refer to Label2 not Label1 and so on.
secondly the example would loop through 4 cells in one row (A1:A4) but I would like the code to apply to several rows ie (A1:D4).

so thats 16 cell and 16 labels. I could code this in a very inefficient way but I am sure ther is a simple method.

View 9 Replies View Related

If/then To Make Cell Blank

Jul 22, 2008

I am using a “borrowed” formula from a coworker that I do not really understand however it is working for me, sort of.

=+IF(ISERROR(FIND("F",UPPER(CONCATENATE($V17,$W17,$X17,$Y17,$Z17,$AB17,$AC17,$AD17,$AO17,$AZ17)))),I F(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(UPPER($R$2),"NA",""),"FAIL",""),"PASS",""),4)="FFFFFFFFFFFFF FFFFF","FAIL","PASS"),"FAIL *")

What this does is read the range of cells and immediately fails a quality check if it is in a critical cell, or fails if multiple non critical items fail.

I want to use an if/then to make cell blank if there is no data in one particular cell (which means no quality inspection performed). Here is what I tried:

IF(V18="","",+IF(ISERROR(FIND("F",UPPER(CONCATENATE($V18,$W18,$X18,$Y18,$Z18,$AB18,$AC18,$AD18,$AO18 ,$AZ18)))),IF(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(UPPER($R$2),"NA",""),"FAIL",""),"PASS",""),4)="F FFFFFFFFFFFFFFFFF","FAIL","PASS"),"FAIL *"))

The leaving the cell blank part of the formula works however it allows the remainder of the formula to only work if “fail” appears in the first cell it reads (in this case V18). If the “fail” appears in any of the other critical cells, it does not work at all.

Also as a side project not sure what the substituting to $R$2 does so if anyone knows how to clean this up, let me know.

View 14 Replies View Related

Formula To Make Cell Blank Instead Of Zero

Oct 29, 2009

I am looking for a formula that will work with my current formula, and check that cells a1 and b1 contains information. If they do contain info then the original formula should carry on as usual and leave the answer in cell c1. I also need it so when no information has been entered in cells A1 and B1, C1 will be blank instead of containing a zero.

This is the formula I have at the moment:
=IF(SUM(A1=0,B1>0),B1-A1,"No Charge?")

A B C
10.1810.82

View 14 Replies View Related

Make Cell Apear Blank

Jan 15, 2009

I have 2 worksheets, i have one sheet that has a form with lists, when nothing is selected the cells are blank. On the other sheet I have a few cells which = some of the sheets on the other worksheet. when nothing is selected, the cell displays 0 even though the cell its supposed to be displaying is blank.

View 4 Replies View Related

Make A Formula Output A Blank Cell?

Mar 20, 2009

I want my formula to output a blank cell if the answer is 0. Ex. [B1=IF(A1=0, ???, A1)]. I want B1 = A1 if A1 is not 0. I want B1 to output a blank cell if A1 = 0.

View 3 Replies View Related

Iserror: Make The Cell Go Blank With N/A Is Returned

Feb 12, 2010

How do I put in iserror in to this to make the cell go blank with N/A is returned. Only ever done this on vlookups. =IF(I15<E8,"TOOLING REQUIRES CALIBRATION","")

View 2 Replies View Related

Make A Cell Display 0 Or Remain Blank Instead Of #N/A?

Aug 15, 2009

How can I make a cell display 0 or remain blank instead of #N/A?

I have several cells that are either VLOOKUP or just normal sum functions but they all display #N/A.

View 9 Replies View Related

Combined If Statements - Make The Second Character In The Blank Cell?

Mar 6, 2014

I have a spreadsheet that i want to create a part number that contains 4 parts. Ex 1rl9. The cell i want this to be in is blank. What formula do i use to make the second character in the blank cell = r?

View 9 Replies View Related

Drag The Entire Thing Down And Be Able To Make It So That It Is Hidden (the Cell Is Blank)

Oct 23, 2009

First, I can get the balance formula, and when I drag the square at the bottom right, I am able to drag the entire formula down...I want to do that. However, when I drag it down, the number keeps popping up. I was wondering if there is a way to be able to drag the entire thing down and be able to make it so that it is hidden (the cell is blank) unless the debit or credit cell in the corresponding row is filled. Also, if possible, I want to be able to drag it down to infinity, so it can go on forever, so that there is no need to always drag it down when I add more things in it. I am attaching what I have till now.

View 5 Replies View Related

Make All Blank Cell Have Dash Without Affecting Other Cells With Data?

Jul 20, 2013

section 100
section 200

100-1
200-1

I have a large spreadsheet with text, numbers and blank cells. Is there a code a can use to make all blank cell have a dash (-) without affecting the other cell with data.

View 8 Replies View Related

Make Cell Blank For Exceptions (calculating Blood Sugars)

Aug 14, 2007

I am calculating blood sugars for my daughter and putting them in a spreadsheet. The formula is simple:

Blood sugar - target blood sugar / 20 which yields the amount of insulin that she needs to take. I want this cell to be blank unless I enter a value in the cell above it.

Next, I take the value from that formula and add it to the amount of insulin that she takes for eating.

The value in the top formula can be 0 or less, but, if the value in the bottom one is less than 0, I want the cell to be blank.

View 9 Replies View Related

Macro To Make A Cell Background Blank If It Is Not Orange Or Dark Blue?

Apr 17, 2008

Does anyone know how to use a macro to make a cell background blank if it is not orange or dark blue?

View 12 Replies View Related

Make Cell Blank If Nothing Is Written In Another Cell?

Oct 30, 2013

I want to make a cell blank if nothing is written in another cell. I have used this formula in C4: =IF(ISNUMBER(C3),IF(C3<180,C3+180,C3-180),"")

View 1 Replies View Related

Make A Cell Blank If Another Cell Is Blank?

Sep 26, 2008

Make a cell blank if another cell is blank? This is my formula, it checks two dates. It is in cell M5.

View 4 Replies View Related

VB Code To Make XY Scatter Chart (relative To Input Cell)

Jul 17, 2014

I have a project coming up where I will receive tables in a certain format. I want to be able to create a macro that well create a chart based on a single inputted cell (start of data). The chart will have 4 series and five values per series. See the link below for sample data! The first data point is not in the same place in the sheet, but the table will have the rest of the data relative to that!

[URL] .......

View 2 Replies View Related

Adapt Current VBA Code To Make More Than One Cell Mandatory To Fill In Before Saving

Mar 30, 2013

I am currently trying to adapt the following code which is in VBA (Sheet1). It currently ensures mandatory cell entry of cell C2 before saving, and if this is not done then it would not save the item into the relevant directory. I would like to adapt this code so that cells B2 to R2 are all mandatory, and if they are not filled in a message box with the cell title (which would be in B1 to R1) would pop up. If the cells are not filled in then it will not save (the same function it carries out for cell c2 currently). The code is attached to a command button, i have tried to make the additional cells mandatory by playing around with the If Trim(.cells(2, 3).value) part of the code with the AND function etc however i have had not had any luck.

View 7 Replies View Related

Efficient Entry Of Data & Automatically Have Their Price Show In Adjacent Cell

Aug 13, 2009

I own a Hair Salon which collates its daily takings using a spreadsheet. A section of this takings sheet asks staff to enter which Products have been sold and what they where sold for (RRP), so that once all products have been entered, totals at the end of the day allowing the end -of-day "till-up" process to reconcile purchases and services rendered aginst cash and cheques received.

Unfortunately there is over 600 products to choose from and this evergroes as new products are introduced by manufacturers. Names are long and often very similar, and product price manual listings are slow to reference, therefore the customer has to wait while the staff find the right product and select the right price.

All of this is subject to human error. What i would like is simply to enter part of the product name into a Cell and the right product to be visibly selectable and the price automatically added to an adjacent cell.

View 4 Replies View Related

Code To Go To The First Blank Cell In Column A

Jun 10, 2009

Here's what I tried using macro recorder...

View 4 Replies View Related

Vba Code For Ending A Sub When There Is A Blank Cell

Feb 17, 2007

I am working on code to detect whether a cell contains an even or an odd number in it. I can do this when I know that the numbers I want to evaluate are in cells A1 trough A10 but the next part of the code is for when we do not know how many entries there are and we have to evaluate until we come across an empty cell and then stop.

View 2 Replies View Related

Add Stipulation That Specific Cell Must Not Be Blank To Existing Code

Oct 21, 2013

I have a code now that in excel, when the button is clicked, will put file into a new email and format the email.

What I have been trying to do, is make it so that if Cell C10 is blank, you get a prompt telling you it must be filled out before you can proceed with the submission.

Here is the code now:

Sub SendTimeCard()
On Error GoTo err_handler
Dim OutApp As Object
Dim OutMail As Object

Dim subject As String
Dim body As String
' Be sure the workbook is saved first
ThisWorkbook.Save

[Code] ........

View 2 Replies View Related

Macro Code To Find Blank Cell In Column

May 30, 2008

Short and simple. What is the quickest, easiest & most efficient way to find the first blank cell within a column using VBA?

View 9 Replies View Related

Looking To Condense Rows

May 29, 2009

I've got a worksheet with a 1-row gap in between every two rows, and I'm hoping to delete those gaps. In the attached spreadsheet, worksheet 1 (Initial) is what I'm starting with, and worksheet 2 (What's wanted) is what I hope to achieve.

Now obviously, if it were only 10 lines of actual info, I'd just cut/paste. But, I've got ~950 rows of info.

View 2 Replies View Related

N/A# Make Blank

Nov 17, 2008

#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A#N/A

=RtHistory("IDN",B5,B7:D7,B6,"LAY:HOR NULL:SKIP ZERO:SKIP SORT:ASC")

the #N/A errors are based on the line above. Is there a way to remove the #N/A? I want to make Row B/C/D above blank

View 10 Replies View Related







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