Macro Not Looping To Correct Position

Sep 19, 2006

I'm having trouble with a macro not looping back to the right place. The macro runs fine but is looping back to the very beginning instead of to the DO WHILE point which is the bit I would like to loop through. The code I have posted is a little long I am afraid (with the first part being largely irrelevant to the issue I am trying to solve), but I have marked where I am trying to get the macro to loop though.


Sub Collect_Trade_Data()

Dim y As String

Dim strResult As String
strResult = Dir("K:BTSFilesMQ_FromBloombergutilities.txt")
Select Case strResult
Case ""

Case Else

Application. ScreenUpdating = False

Workbooks.OpenText Filename:="K:BTSFilesMQ_FromBloombergutilities.txt", _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _ ...............................

View 9 Replies


ADVERTISEMENT

Countif Formula: Added The Correct Amount In The Correct Cells

Feb 15, 2010

I'm trying to create a formula that will added the correct amount in the correct cells, I have create a dunny sheet in trying to achieve this. If Cell B8:B11 = ABS or Dum that any points won should be added to Cell L8:L11 right now its adding it into K8:K11. If Cell B8:B11 = is Blank any player points should be added to cells K8:K11. I'm using this formula throughout cells K8:K28 =IF(J8>J25,1,IF(AND(J8<>0,J8=J25),0.5,0)) Any thing in red is incorrect anything in blue is what I'm trying to achieve.

View 4 Replies View Related

Check Cells Are Correct Format And Contain Correct Data

Jan 26, 2014

We receive about 20 sales files of several hundred lines of data each day from various agencies. I want to create a macro / VBA code which checks that the data submitted is correct so that we can upload it into our database without import errors and / or having to manually check each line of data.

I envisage something like an output report:

#####################
149 entries
Column A - Date - OK
Column B - Customer_Phone - Errors (Should be 11 digits)
Row 21 - Customer_Phone - Error (Not 11 digits)
Row 108 - Customer_Phone - Error (Contains letters)
Column C - Outcome - OK
Please correct and re-check.
#####################

View 4 Replies View Related

Sumproduct- Counts The Correct Amount But Not With The Correct Dates

Jul 3, 2008

I have a table with 3 columns of dates and then a column with Set # that I
feel in the box #.

I need to see how many items processed for each set per day.

Example:
[url]

The problem is that it counts the correct amount but not with the correct
dates.
The formula that I use is:
=SUMPRODUCT(--($I$3:$I$8<>"")*(($C$3:$C$8=39601)+AND($E$3:$E$8=39601)+AND($G$3:$G$8=39601)))

View 14 Replies View Related

Position Independent Autofill Macro

Feb 4, 2010

I need a macro that can autofill irrespective of where the source cells are. Like, this is what I want to do:

Select two cells containing a descending order such as 50, 40. Hit the hotkey and the macro should autofill the same way as double clicking the bottom right corner of the selection.

The problem is that the two source cells can be anywhere in the sheet, and autofill range isn't fixed. Essentially, I just want a keyboard shortcut for Excel's own Autofill function.

I want this macro to be rid of the mouse when I'm working on excel (it really slows me down to use the mouse every time I want to autofill).

View 9 Replies View Related

Macro Computing Planetary Position

Sep 14, 2006

Im looking for an Excel macro that will allow me to input any date and time and produce x,y,z co-ordinate results for planetary positions relative to the centre of the universe. I already have a database with ephemeris data but find it difficult to use manually inputting date and time constantly. I need to perform so many calculations that automating this procedure is essential to me but i dont know how.

View 2 Replies View Related

Looping Put Into A Macro

Nov 2, 2009

Aloop I am trying to put into a macro. I have a variable range of data in Column C, header is in C1. I need to split the data in each row of the array using this code.

View 2 Replies View Related

Macro Needs Looping (I Think)

Jun 17, 2008

I have a macro (written with the help of forumites here) which, when selecting a cell on a particular sheet, will select and copy data from various rows on various sheets, print a resulting chart, before returning to the original sheet.

Now, I use autofilter on the original sheet to help organise the data I wish to copy and print.

My question: is it possible to adapt my macro so that, once it has run through once, will move to the next cell in the autofiltered column and run the macro again, and again, and again... to the bottom of the autofiltered column?

At the moment, I'm running the macro, pressing the 'down' key and then running the macro again until I've exhausted the column. There must be an easier/better way.

View 9 Replies View Related

Looping In Macro

Sep 25, 2008

The below code outputs a value in the cell corresponding to alpha by drawing information from the range in issueRng. However it will only grab the value from the first cell in the range of issueRng. It grabs this cell value and outputs it in every cell corresponding to alpha. For instance if i have issueRng as the range from C6 to E6 (3 cells), then the code draws the value of C6 and puts it in the cell corresponding to alpha which for the first loop is Cell(7,6). However the code is putting the value from C6 into every cell instead of moving through the range of issueRng.

Dim alpha As Double
alpha = 6
Dim issueRng As Range
Set wb = ActiveWorkbook

With wb.Sheets("Issues")
Set issueRng = Sheets("Issues").Range(.Range("C6"), .Range("C6").End(xlToRight))
End With

For Each CELL In issueRng...............

View 9 Replies View Related

Looping My Macro

Aug 20, 2009

I am a bit stuck in looping my macro. I have a working macro that does various functions for a period (say January) and I wish to run for periods 1 to 12. The cell "A1" has a drop down list (jan09, feb09 to Dec09).

Currently I select the month from Cell A1 and run the macro. Now wish to loop this macro so it runs from Jan09 to Dec09 in one go. The cell A1 is being refererence in the Vlookup table that changes ranges in a table that are been used as dynamic ranges in a macro.

Simplied Macro Steps
1. Select month in cell A1 (sheetX), then Calculate.
2.This refeshes lookup table and runs the macro say copies cells (B10:D100) in sheetBud and pastes in sheetTest A10. Insert rows A10:A100. Ends

Currently I manually changes the step 1 and then run this macro for next month. But now wish to run it for 1 to 12 months in one go. Please please can you can help me with the Looping. Please note that the macro does other functions and the steps above are simplied.

View 9 Replies View Related

Position Cell In Top Left Position

Jan 7, 2009

Is it possible to position a predetermined cell (e.g. A42) in the top left corner of the screen. (Not every screen users use has the same size)

View 3 Replies View Related

Macro To Hide Column With Relative Position

May 16, 2014

I am trying to hide a column titled "Test". This column is usually column E, but it is possible it can be moved to column D or F. If I use:

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

Then column E is hidden, regardless of whether Test is moved left or right. The reason Test moves is due to the user inserting or deleting a column.

View 5 Replies View Related

Macro To Move Cursor To Home Position

Mar 15, 2014

Doing a search function where the cursor is on a row some where (unknown).

I would like to move the cursor to the first column of the spreadsheet.

View 2 Replies View Related

Row And Column Looping Macro

Oct 23, 2008

What I'm trying to do: While there's a value in Col A starting with A2, I need to then go to the corresponding cell in Column O, starting with O2. Then as long as there's text in the next cell in the same row keep track of those cells so that in the end I can append all text in the adjacent cells to the text in the Col O[X] cell. Then repeat as long as there's text in the next row cell of Col A. I have the routine to append the text, I just need help with the looping.

IE:

If I start with the following:

Col A Col O Col P Col Q
row 1 ----- ----- ----- -----
row 2 1 Text here new text
row 3 2 More text more text 2 more text 3
row 4 (no text in any of this row.......................................)

After running macro this would become

Col A Col O Col P Col Q
row 1 ----- ----- ----- -----
row 2 1 Text here..............................

View 5 Replies View Related

Looping A Macro, Filtering

Oct 27, 2008

I have created a macro to filter results from a set of data, paste that data to a new file, and then create charts based on that data. Right now, my macro is basically multiplied 20 times to do this for each heading. Is there a way to create a loop that will just redo the same macro but for the next data heading? Here is a sample of the first part of the macro:

View 14 Replies View Related

Ending A Looping Macro

Nov 9, 2009

I have a macro I use cleanup up excel data I paste into it. Currently I paste in data that is three columns but there is space between the different items. For example:

View 2 Replies View Related

Looping Print Macro

May 19, 2009

A macro that scans Sheet "CSD" Range "B4:B201" for the word "Yellow" and copys the data in the row based on conditions to Sheet "Yellow Ticket" and prints the Ticket.
Heres a Pic of my "CSD" Sheet.

******** ******************** ************************************************************************>Microsoft Excel - Hybels_Loading_Tickets redo for post.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutA1=ABCDEFGHIJKL1  Starting Load #         2  3800         3 Ticket ColorLoad #DropCart #Customer ALLSTARS4" Wave3-0-6 Wave6" Wave18-0-1 Wave10" HB4 Pink3851C1Hawks27  45  5Yellow3852D3Bomgaar's 28 67    6 Yellow3850E5Larry's  34  677            8           9            10            11           12            13            14            Count Sheet Esman Greenhouse's [HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name boxPLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

Here's a pic of my "Yellow Ticket"
******** ******************** ************************************************************************>Microsoft Excel - Hybels_Loading_Tickets redo for post.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutA1=ABCDEFGH1R. Hls Inc.2Helping Make Your Business Grow!3        4For questions regarding product please call 800..!5For questions regarding shipping or cart removal please call 888-344.3710!6        7    Load #                                    Drop Letter                            Cart
#(1-30).....................

View 14 Replies View Related

Progress Bar For Non-Looping Macro

Aug 12, 2008

I'm running a simulation that utilizes the Data Table function. The table itself is quite large (280 elements in the row, 10K in the column). It currently takes about an hour to run. (Full disclosure: I did this instead of a couple of "for" loops because I have to consolidate/manipulate a bunch of data from several sheets and it seemed to be running slower than a data table). how to write a progress bar for this type of code? I.e. code that does not loop and is just time-consuming?

View 4 Replies View Related

Reference Named Range By Position Macro Code

Mar 11, 2008

This seems really basic, but I can't seem to find it...

Using Visual Basic, if I have a named range, lets say like "NAMEDRANGE", how can I refer to cells in that range by their position in the range? For example, if I want to refer to the cell in the 2nd row and 3rd column of the range.

Also is their an easy way to refer to the first(top-left) cell in a named range?

View 3 Replies View Related

Sum Macro With IF Formula - Enter Correct Value Into Column

Dec 8, 2011

I want to create a Macro that uses IF statements to enter the CORRECT VALUE into COLUMN “Q” in the ACTIVE WORKSHEET. I am providing an example of what the data set looks like at the very bottom of this post. I want to use a Macro as oppose to Formula in the worksheet because I want to turn the Macro into an Excel Add-In.

I want the Macro to do the following THREE THINGS:

1. IF the Value in COLUMN L is “0” THEN enter “n/a” into COLUMN “Q”
2. IF the Value in COLUMN L is “2” THEN enter “n/a” into COLUMN “Q”
3. IF the Value in COLUMN L is “1” THEN use a formula that looks like this:

= O8 + ( ( O8 / P8 ) * (First SUM the HOURS in COLUMN O for all the ROWS that have the SAME VALUES in COLUMN C and H and a “2” in COLUMN L and then MULTIPLY that Result against those rows with a “1” in COLUMN L whose COLUMNS C and H values match up exactly with those of the Summed Hours). The RESULT of the FORMULA would be entered into COLUMN “Q”. Once you look at the example at the bottom of this post it will definitely start making sense. I highlighted rows 8 – 11 for you in red in the data set at the bottom of this post just to center the attention on the rows I am talking about.

Here is an example of how the formula will work:

I will use ROW 8 from the data set below as an example. From the dataset I know CELL O8 equals 10 and CELL P8 equals 76. Now I will SUM the HOURS in COLUMN O ROWS 10 and 11 for ALL ROWS that have the SAME VALUES in COLUMN C and H in this case the values are “Times” and “PM” and contain a “2” in COLUMN L which happens to equal 3, then that 3 should only apply to those rows with a “1” in COLUMN L whose COLUMNS C and H values match up exactly with those of the Summed Hours. So now I plug that into the formula: =10+((10/76)*(3)) and MY RESULT which will go into COLUMN “Q” IS 10.395.

Here the DATA SET:

Col A Col B Col C Col D Col E Col F Col G Col H Col I Col J Col K Col L Col M Col N Col O Col P Col Q Col R Col S Col T
Row 1 B ID Name Org Div T Number Model Make S Function E Function Type Description P ID OG Hours Sum EA P Hours Sum P S Hours EQ

This is what is happening in Column Q Explanation of Formula

Row 2
Times
Cont
2
28 28 n/a

n/a If formula populates Column Q cells with "n/a" if Column L cells contain a "0" or "2".

Row 3
Times
Cont
1
404 1194 413.4740369

O3+((O3/P3)*28) You get the Sum "28" by adding all the "P Hours" in Column O that match these 3 values:
1. The "Org" value of "Times" in Column C
2. The "S Function" value "Cont" in Column H
3. The "P ID" value "2" in Column L

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

View 9 Replies View Related

Macro To Convert Dates To Correct Format

Jun 7, 2013

When I import data , the dates appear as follows in Col G sheets "Imported Data"

If I select Col G and use Text to columns and select mdy, it gives me the dates in the correct format. However, If I use the macro recorder to do this and then run the macro, it does not work

I have attached the dates after using text to Columns wjhich is the correct format.

Imported Assets *G207/01/2006302/01/2007402/01/2007511/01/2008601/01/1985720/11/1990801/01/1985901/01/19851001/01/19851101/01/19851225/09/19921302/01/1993

Imported Assets  G201/07/2006301/02/2007401/02/2007501/11/2008601/01/1985720/11/1990801/01/1985901/01/19851001/01/19851101/01/19851225/09/19921301/02/19931401/05/19931501/06/19931601/08/19931701/01/19941801/09/1995

View 2 Replies View Related

Faulty Macro Run While Automatic And Correct While Manual (F8)

Aug 1, 2013

Is it possible that the very same macro runs kind of incorrectly while it's being run as "automatic" (F5 key) and absolutely correctly while run manually, line by line via F8 key?

I am trying to debug the code but no luck as I get proper results while run manually.

View 6 Replies View Related

Importing Data In Correct Format For Macro To Run

Aug 17, 2008

We have a system that normally dumps our data in the format of column K, with all of the data in one column and the same spacing you see below in red. The problem is when the system is slow, we have to manually dump it, and when we manually dump it, it comes out spread out from column A to column I. For the macro to work without bugging out on me, it has to be in the same format as column K, with exactly the same spacing.

I have tried text to columns while importing, amongst other things, but have not had any luck. So in a nutshell I need to be able to make column A thru I, look just like column K with exactly the same spacing. The data dumps are different every day.

I have a strange feeling I will not get a reply on this question, because it is so strange, or that I failed to articulate it correctly....

View 9 Replies View Related

Identify Correct Embedded Chart With VBA Macro

Oct 8, 2008

I have several charts embedded in a worksheet, and I would like to use the ChartObjects Method in VBA on some of them. That requires knowing the index number of the charts I want to work with. Where/how do I get that? (For example, in the VBA Project Explorer window the only listed objects are sheets. Is there an object explorer with a chart list?)

View 2 Replies View Related

Looping Data Entry Macro

Sep 26, 2008

I want to use a piece of VBA to copy values from cells A1, C1, E1, and G1 and paste them into the next blank cell in an existing range called "DCopy". I am trying to use the following code, but as I have never tried writing a looping macro, have no idea what I am doing:

View 2 Replies View Related

Looping A Macro Through A List Of Workbooks

Oct 3, 2007

I have a macro that will go into a workbook and copy all applications from a given date onto a master workbook. I have another workbook that has a list of around 20 workbooks and i want the macro to go into each one, and copy over the data onto the master workbook. I have the code to copy it over but i can't get it to loop thru the list of 20 workbooks.

View 9 Replies View Related

Looping Macro: Summing Up All The Values

Sep 24, 2008

So this code works fine without any error messages but I need to add a sum feature. Any ideas on summing up all the values from the for statement into the cell that corresponds to the value of the variable t. I think i need to store the the value of the for statement as a variable and then at the end of the for statement add the next value from the for statement and so on

Dim t As Integer
Dim m As Integer
t = 7
m = 11
Do While Cells(t, 7) ""

For m = 11 To (30)
col = Split(Columns(m).Address(0, 0), ":")(1)
Cells(t, 8).Formula = "=VLOOKUP(G" & t & ",indirect(" & col & 2 & "),2,FALSE)"
m = m + 1
Next m
t = t + 1
Loop

View 9 Replies View Related

Looping Macro Contional Formatting

Dec 29, 2008

Sub highlight()
Range("AB6,Y6,V6,S6,P6,M6,J6,G6").Select
Range("G6").Activate
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLessEqual, _
Formula1:="=$D$6"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = True
End Sub

the only thing is i can't get it to do it for the hole spreadsheet!

i could copy it on to each line! I have 105 .lines and it needs to be compared to a number that is on that line!

I have tried to use some
i = 1 to 105 ---- but i don't know what that means, where to put it or how to use it

just so you know the basic of why i'm asking this is
i work for a small tv station, as most media it has ratings.. I have to highlight the 15 minute blocks of time that we rank higher in!
so for example!

US - time frame - rating Them - rating
1st 15 minutes .05 1st 15 minutes .02
2nd 15 minutes .03 2nd 15 minutes .09


but i have like 8 other stations and a full 24 hour period i normally highlight

View 9 Replies View Related

Looping A Macro To Build A Report

Jul 14, 2009

I have a very large workbook which includes 100 sheets (A) each containing fixed data relevant to one unit (n) (in this case n = a building; there are 100 buildings), a few sheets (B) containing parameters & settings, and then 1 main sheet (C) which does complex calculations pulling & combining data from sheets (A) based on the parameters in sheets (B). The workbook is so large, (100MB+) that it has to be set to calculate manually.

One of the settings in one of the sheets (B) dictates which building (n) is currently being looked at. As such, sheet (C) effectively builds a report for building (n) and so can report on just one building at a time, that building (n) being determined by a drop-down box listing all of the available buildings and that list is in turn defined in one of the sheets (B).

If I want to get a consolidated picture for all buildings I currently manually change the building choice (n) in the dropdown box, and then run a macro (m1) which updates the report to show what I want, selects the specific bits of the report I want and copies the selection, switches to a separate pre-formatted consolidation sheet I have created (D), jumps to the last row in that sheet, pastes values and then jumps back to Sheet (C).

I then need to manually change the selection (n) and then rerun macro (m1).

What I would like is another macro (m2), which automatically loops through the different values for (n) so that the whole process is automated. Then in a perfect world, perhaps even a separate macro (m3) which would give me a list of tickboxes so that I could select specific properties for which to run the report.

View 9 Replies View Related

Looping Through Each Worksheet And Calling A Macro

Jan 13, 2010

I had create a few macro with the macro name the same as the worksheet name.

How can i create another macro to loop through all the worksheet and if there is any data in Cell A1, it will call the corresponding macro. If there is no data, it will go onto another worksheet.

View 9 Replies View Related







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