Posts by dangle

    Re: Finding Variables and inserting row below them from a list


    Bobd


    Give this a try and let me know if it's doing what you want.


    Re: Creating new sheet and naming it after imported excel file in excel with VBA


    Well, OzGrid is always a good start!


    http://www.ozgrid.com/VBA/


    But keep using (and searching) the forums here and elsewhere, asking questions as you go and practise your own coding, either based on your own projects or scenarios found in the forums.
    Often just a web search will bring up lots of help. E.g. 'vba with statement'.


    Good luck!

    Re: Creating new sheet and naming it after imported excel file in excel with VBA


    This would create new sheets for all the filenames listed in column C:


    Code
    Sub Example()
    Dim r As Range
    For Each r In Range("C8", Range("C" & Rows.Count).End(xlUp))
        If Not IsError(r) Then
            Worksheets.Add(After:=Sheets(Worksheets.Count)).Name = r
        End If
    Next
    End Sub


    However, your code needs some work. For instance:
    Dim all your variables at the start of the code
    Avoid using Select, Activate and ActiveCell where possible. You can normally work direct with the object, often using the 'with' statement.
    E.g.

    Code
    Sheets("RawData").Select
        Range("G2").Select
        If ActiveCell.Text <> "" Then


    Could just be:

    Code
    if Sheets("RawData").range("G2") <> "" then


    Or you could also set up object variables for your workbooks, worksheets and ranges and then refer to these in your code.

    Re: Generate specific number of worksheets based on cell number.


    Hello Singularity and welcome to the board


    Try:


    Code
    Sub CreateSheets()
    Dim i As Long
    For i = 1 To Sheets("Sheet1").Range("A1") 'Your cell reference for number of days
        Sheets("Sheet2").Copy After:=Sheets(Worksheets.Count)
        ActiveSheet.Name = "Day" & i
    Next
    End Sub

    Re: consolidate duplicate listings, merge all info from one column


    Maybe something like:


    Re: Transposing Excel Data - Repeating Column Headers


    Give this a try and see if it works for you:


    Re: Copy specific worksheets values only to a new workbook


    There may be slightly better ways of doing this, such as using a 'select case' statement rather than multiple 'if' statements and organising the unhiding/hiding of sheets, maybe use some additional subs, but I am not sure that this is your issue if you are saying it is noticeably slow.
    How about:

    Code
    Application.Calculation = xlCalculationManual
    'Your code
    Application.Calculation = xlCalculationAutomatic

    Re: find loop to search value in column A only, on location copy/paste in new locatio


    Add this line at the beginning of your code and I think you will see what the problem is:


    Code
    MsgBox ActiveCell.Address


    Try to avoid using ActiveCell if at all possible. It is likely to give you unexpected results.


    I have adapted your code:


    Re: Changing Rows to Columns


    This might work based on what you have provided and if each group of data is structured in the same way. But AAE is right, it would be much easier if you provided a sample workbook.


    Re: Copy specific worksheets values only to a new workbook


    I don't know if this is really what you are looking for and it would help to see a sample file but here is a possible. Note it saves the "Summary" workbook.


    Re: Macro to move text to columns and output as list populating specific data.


    Hi Chris


    Hope this is of use: