for and next statements

  1. D

    Find and Replace any characters in a list of characters

    Hi, i could really use some help with this. i have this code that checks a column for an illegal character (for sheet name) and replaces it with "_". I want it to check for the fill list of characters that are not allowable sheet names .Pattern = "[\<\>\*\\\/\?|]" Sub...
  2. Ivan Howard

    VBA Loop to change label/text box object properties

    Hi All, Please could someone give me a hand. I'm not sure if this can be done the way I am trying to do it. Basically, I have a userform with 40 labels on it (amongst other objects) and would like to update the BackColor property using a "For... Next" statement - instead of writing 40 lines...
  3. I

    Unable to execute macro

    Hi Guys, I'm having some issues trying to run the macro below. I'm trying to copied the filter data from wbI to the each tab on another workbook (tickets). i seem to have missed out something but i can't figure it out. Much appreciated if someone could shed some light. Thanks! Sub Trial()...
  4. J

    For Loop Over Multiple Ranges

    Hello all, new to the forum but not to the site. Found many an answer or direction to start when dealing with my macros. So thanks for that. Unfortunately my current issue is above my skills and I can't find a forum that helps me find the answer, or I'm just not searching for it properly. I'm...
  5. H

    Basic Variable Problem

    Hi Everyone, First off, a huge thanks to everyone helping out here - I love this community and have learned so much from reading other threads. :) I'm trying to do a very simple for loop that cycles through sheets and executes a long code within that sheet. However, for some reason, the for...
  6. M

    Skipping an i, or multiple i's in a Loop - please help

    I am writing some code to generate multiple pivot tables in excel. My spreadsheet is set up with survey responses to a variety of questions with the question number across the top, and the survey responses below in the column. My problem relates to questions 8, 10, and 13. As you can see in...
  7. N

    VBA -- Populate array with cell references (addresses)

    Hi everyone, Hopefully this is a pretty simple fix, as I'm just beginning to become familiar with arrays in VBA. I'm looking to fill an array with the cell addresses using a For loop. I'm wondering if the problem is occurring because the arrays are by default Variant (?). Thanks for your help...
  8. N

    Need help with looping and find the same day, and month from the loop

    Hi guys, I new to excel and I'm having problem how to program it to my vba.. I have worksheet, that contain column: DATE, PIECES, and CODE THINGS <tbody> <tbody> DATE </tbody> <tbody> PIECES </tbody> <tbody> CODE THINGS </tbody> <tbody> 01/01/2015 </tbody> 7 <tbody>...
  9. A

    Embedded For Loops

    Hello, I am a self-taught VBA writer, and my work is wanting me to do something beyond my knowledge. I have a table that contains Vendor, Platform, Model, Category, and Component. I need to have a list off to the side containing a list of Platforms and Components that can be added to, but the...
  10. M

    On Error GoTo Issue with Worksheet Function

    Hello, I am having issues with the following code in Excel 2010: Dim i As Long Dim NewBottomRow as Double Dim Row as String For i = 1 To NewBottomRow - 1 On Error GoTo Hop Row = Split(ActiveCell(1).Address(1, 0), "$")(1) Selection.Value = WorksheetFunction.Average(Range("A"...
  11. myactiondesign

    VBA Repeat InputBox Entry IF...

    Hi All, I'm really stuck and would appreciate some help if any of you have five minutes to spare - my VBA knowledge is growing, but still limited. I am looking to have a user InputBox to enter sales for 6 weeks, as shown below: --- Sub InputUserData() 'This sub will create six messages boxes...
  12. L

    Moving cells around help needed.

    Hi, I'm trying to make a macro that will make my life easier. What I would like to do is scan through column "A", when the next cell down does not match the previous cell. I would like to move that Cell and the cells next to it to the top of a new un-used column. I created an example of what...
  13. J

    Nested For Next Loop

    Hi, I am new to the vba world and would really appreciate help with this problem. I am basically picking up a security from a sheet through a loop and pasting it on the 2nd sheet. After some minor calculations, I am running another loop on the second sheet looking for "Yes" and pasting the...
  14. B

    Using an integer to call next values

    I have the following code to copy a select range of cells from one sheet and past it to another sheet when specific checkboxes are checked: Rng1 = ("A4:I14") Rng2 = ("A15:I26") If Sheets("Setup").Cells(nbr, 3).Value = True Then Sheets("TestPro").Range(Rng1).Copy PasteValues End If This...
  15. R

    Error Handling

    Hi, I have some code with opens a file one at a time from a list and this works fine until the file in the list cannot be found in the already specified location. My only problem is what the code does when the file cannot be found. Currently, Excel displays a error message and then gives me...
  16. N

    VBA Highlighting under multiple conditions

    Hey, I have a sheet here that auto-populates with a list of warnings/errors. they start at row 3 and keep going until the list is finished. I'm trying to find a way to highlight only errors if there is no false positive message offset 2 columns from that error. This works fine for highlighting...
  17. J

    Error-Handling for Repeat VBA Code for Multiple Values

    I think the code is fairly self-explanatory, but I'm trying to search for a number (VehNum) in a column (VehCol) and copy all of the rows with the same number in the that column to a new sheet. I'm receiving a "Run-time error 1004: Application-defined or object-defined error" in 14th line of...
  18. E

    For...Next Sheet Help!!!

    Public Sub Insert_Identifiers() Dim count As Integer For count = 1 To 2 'MY CODE Sheets(count).Columns("A:A").Select Next count End Can any one tell me what I am doing wrong that I have manually select sheet2 in order for the code to work. I really am blind sided as to what I am doing wrong.
  19. J

    Compare rows between 2 sheets - slow

    Hi, This works but can anyone think of a way to make it faster? It needs to look through over 15,000 rows. Set Sh_1 = ActiveWorkbook.Sheets("NFC Allocations") Set Sh_2 = ActiveWorkbook.Sheets("RSL") For r = 2 To Sh_1.UsedRange.Rows.Count For s = 2 To...
  20. O

    Next without for error msg & I have end if

    I am stumped...any ideas why i get the "Next without for" error message? checkstructure is the name of the function. My suspicion is the "Exit For" in the Else statement is not allowed? Dim STVal As String STVal = "ST050" Dim i As Integer Dim myanswer As Double Dim myCheckVal As Boolean...

Some videos you may like

This Week's Hot Topics

Top