Help with excel macros

Good morning:
I need help with a macro that let me solve the following situation:
1. I have an excel file with the following format:
Book
Chapter
Verse
60
5
7
43
14
1
50
4
6
50
4
7
51
3
15
23
26
3
2. First I want to convert the file to this format:
60.5.7
43.14.1
50.4.6
50.4.7
51.3.15
23.26.3
3. And finally to export them to a file called Bookmarks.xls with the format:
bgroup
verses
Default
60.5.7, 43.14.1, 50.4.6, 50.4.7, 51.3.15, 23.26.3
I have some 40 files that need to be converted. All have the same format but the number of rows varies. By the way I am using Excel 10.
Your help with this matter will be greatly appreciated.

Perhaps you can use this as starting point:
Sub Transform()
Dim wshS As Worksheet
Dim wbkT As Workbook
Dim wshT As Worksheet
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
Set wshS = ActiveSheet
m = wshS.Range("A" & wshS.Rows.Count).End(xlUp).Row
Set wbkT = Workbooks.Add(xlWBATWorksheet)
Set wshT = wbkT.Worksheets(1)
wshT.Range("A1") = "bgroup"
wshT.Range("B1") = "verses"
wshT.Range("A2") = "Default"
For r = 2 To m
wshT.Cells(2, r) = wshS.Cells(r, 1) & "." & wshS.Cells(r, 2) & _
"." & wshS.Cells(r, 3)
Next r
Application.Dialogs(xlDialogSaveAs).Show
Application.ScreenUpdating = True
End Sub
Regards, Hans Vogelaar (http://www.eileenslounge.com)

Similar Messages

  • Help with excel output.

    How can I get the out with Excel format.  Here is the steps and output desire.
    The trick is I want the excel out put with specific format date, I have tried using SSIS 2012 for several days and it did not work.  The file must be in this format.  I google and try several examples but it failed.  Here is my codes below. 
    Any help is greatly appreciate.
    I have to schedule the job to run each night and output Excel file with date format below.
    date format: DDMMYY append to the file.
    Daily_Report_280115.csv or Daily_Report_280115.xlsx
    IF OBJECT_ID('dbo.usp_RptGetUserLogin', 'p') IS NOT NULL
      DROP PROCedure dbo.usp_RptGetUserLogin
    GO
    CREATE PROCedure dbo.usp_RptGetUserLogin
    @DBName     VARCHAR(40)
    AS
    **      Description: 
    **       Written by:
    **     Written date:  01/23/2015
    **    Modifications:
    **    ------------+---------------+-------------------------------------------
    **    Date:       |  Author:      |   Reasons:
    SET NOCOUNT ON;
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
    DECLARE @SQLStr  VARCHAR(8000)
           ,@crlf        CHAR(1) = CHAR(13) + CHAR(10) -- carriage return, new line.
         --INSERT dbo.#AuditUserLogin (LoginId, DBName, UserName, UserOrAlias)
            --PRINT '-- go 2.'
            SET @SQLStr = 'USE ' + @DBName + ';' + @crlf + 'SELECT CAST(p1.name  AS VARCHAR(40)) AS [LoginName],
                CAST(db_name() AS VARCHAR(40)) AS [DBName],
                CAST(p.name AS VARCHAR(40)) AS [UserName],
                CAST(CASE
                  WHEN (p.is_fixed_role = 1) THEN ''MemberOf''  -- 1 = in one of the DB role.
                  ELSE ''User''
                END AS VARCHAR(20) ) AS [UserOrAlias]
           FROM sys.database_role_members AS r
           JOIN sys.database_principals AS p
             ON (r.role_principal_id = p.principal_id)
           JOIN sys.database_principals AS p1
             ON (r.member_principal_id = p1.principal_id)
          --WHERE (r.member_principal_id > 1) -- Exclusive dbo user.
       ORDER BY p1.name ASC, p.name ASC;'
       PRINT @SQLStr
       EXECute (@SQLStr)
    GO
    DECLARE @SQLString VARCHAR(5000)
           ,@sToday CHAR(6) =  REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), '/', '')
    SELECT @sToday
    SET @SQLString = 'OSQL /E -w2000 /d DBAMaintenance /S. ' + '/Q"EXECute dbo.usp_RptGetUserLogin @DBName = ''Dev''' + '" /o C:\ExcelOutPut\' + 'Daily_Report_' + RTRIM(@sToday) + '.csv'
    SELECT @SQLString
    --OSQL /E -w2000 /d DBAMaintenance /S. /Q"EXECute dbo.usp_RptGetUserLogin @DBName = 'Dev'" /o C:\ExcelOutPut\Daily_Report_280115.csv
    --EXECute Master..xp_cmdshell @SQLString
    -- Desired output:
    LoginName               DBName UserName       UserOrAlias
    dbo                     Dev       db_owner       MemberOf
    MyDomain\QA_ReadOnly_DB   Dev       db_datareader MemberOf
    MyDomain\Dev_ReadOnly_DB  Dev       db_datareader MemberOf
    MyDomain\languyen         Dev       db_datareader MemberOf
    MyDomain\languyen         Dev       db_datawriter MemberOf
    Lam                     Dev       db_backupoperator MemberOf
    Lam                     Dev       db_datareader MemberOf
    Lam                     Dev       db_datawriter MemberOf

    You try using BCP
    https://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/
    BTW, Are you using SQL 2000?
    Also you can try with Powershell
    https://gallery.technet.microsoft.com/PowerShell-Export-SQL-Data-67bcb690
    --Prashanth

  • Help with Excel, please

    Would be very grateful for help with my Excel spreadsheet.
    My workbook contains 20 or so worksheets. I was trying to copy column totals across a particular sheet when it disappeared. After trying to find the missing sheet, called 'Jan 2011', and giving up, I decided as a last resort to re-create the worksheet. However, after inserting a new sheet and trying to re-name it 'Jan 2011', I get the error message that this sheet name already exists. Does anyone have any ideas on where it might be? Many thanks

    You need to post over on the Microsoft Office for Mac forums.  Google will help you find them.

  • Help with excel formula

    hi,
    I need help with some excel fomulas,  I have a source file which 2 cells will continually change, I want to link this source file to an inventory file and update the information on seperate lines when the information is changed without changing the
    destination information
    is it possible or do I have to create seperate source file

    Hi,
    According to your description, my understanding is that you have 2 files (A source file and an inventory file) and link the source file to inventory file. You want to retain the data in the inventory file when the source file continually change.
    If it is, there is no formula will retain the linked data after the data source changed.
    We may try the workarounds:
    1. Use import data from source file to the inventory file.
    2. Create seperate source file
    If I misunderstand, please let me know and share us more information about your demand.
    Regards,
    George Zhao
    TechNet Community Support

  • Help needed - Excel macro error after Reader 11 update.

    I wrote the following section of an Excel 2010 macro to open a selected pdf file with Adobe Reader, then copy all text to the clipboard & then return to Excel to paste &
    process the data. The macro works with Adobe Reader 10.  After I updated to Adobe Reader 11, Reader 11 will open but I get an error message of file not found. I've gone back &
    forth between Reader 10 & 11 from clean installs & the problem stays with 11. The only thing I changed in the macro is the path for where Abobe Reader is located. The only
    Adobe Reader preferences I change from the clean install setup is I set the Default View to Single Page continuous.  Any help would be appreciated.
    'Get the data file (pdf) to open
    fileToOpen = Application.GetOpenFilename("PDF Files (*.pdf), *.pdf")
    If fileToOpen = False Then Exit Sub
    Application.Wait Now + TimeSerial(0, 0, 1)
    'Filepath for Adobe Reader 10 program for Windows 64bit systems
    MyPath = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"
    'Open PDF file with Adobe Reader
    Shell MyPath & " " & fileToOpen, vbNormalFocus
    'Wait for Adobe to Open file
    Application.Wait Now + TimeSerial(0, 0, 5)
    'Select all text [Ctrl-a](Adobe Reader set for Single Page Continuous)
    SendKeys ("^a")
    'Copy selected text [Ctrl-c]
    SendKeys ("^c")
    Application.Wait Now + TimeSerial(0, 0, 2)
    'Turn off screen updating
    Application.ScreenUpdating = False
    Here's the only difference in the macro for Adobe Reader 11
    'Filepath for Adobe Reader 11 program for Windows 64bit systems
    MyPath = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"

    Hi,
    I do not see any reason for this to not work.
    Is there any difference between the preferences for RX and RXI. Please go to "edit" -> "Preferences" -> "Security(Enhanced)" and uncheck "Enable protected mode at startup".
    Are you able to open any pdf from command line with the same command:
    "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"  <<PDF_FILE>>
    Thanks,
    Amish.

  • Help with excel document

    hello all,
    I have an excel base `database`on which I have been working on for about 10 years. It basically has all my music data from all this time, i.e. it is very important for me.
    I keep a copy on my Palm TX in case I need to make notes on the go, and I syncronize with the dataviz documents to go application.
    Today during sync, the process unexpectedly stopped, and now I cant seem to open the file. I double click, excel starts, but no open.
    Anyone might have any idea what caused this? If anyone can help I am willing to send the file for revision-correction.
    thanks all

    By the way, when I move the file to a PC and try to open it, I get the following message
    éxcel caused an error in MS097.dll. Excel will close
    Help!
    J

  • Need help with Excel and ActiveX

    I am new with working with ActiveX, so I need some help regarding writing to a spreadsheet. Here is what I need to do:
    1.The user weighs a product on a scale.
    2.The user presses the weight button control in labview to retrieve the weight via serial port.
    3.The value gets written into a spreadsheet, starting at D2.
    4. User weighs the same product after use to get a new weight.
    5. labview goes through the same process, but this time it gets written to E2.
    6. Differential is calculated (still debating on having the user do this in Excel instead of Labview, since they have to set up a spreadsheet outside of labview for other info not related
    to weight).
    7. User close labview when finished.
    The serial comm and all is fine, but the problem I am having is trying to get a specific cell value written in D2 and then getting another value to be written in E2. For example, initial weight would be D2 and post weight would be E2, and then differential would be F2. For the next product, it would be D3, E3, F3, and so on. What would be the best way to implement this? It looked as if ActiveX would be the only real way to tell Excel where to put the data, but there is still alot I have to learn in where to find and use the proper nodes to complete the process.
    Thanks,
    Jody M.
    The Procter and Gamble Co.
    Certified Labview Developer
    Currently using LV2012.

    Hi z2830than,
    see the attached example. It make following things: open Excel, create new Workbook, ..., write Data to D2, save Workbook and close Excel.
    Hope it helps.
    Mike
    Attachments:
    Excel_open_write_close_Example_LV71.llb ‏234 KB

  • Help with Excel IF AND (OR) formula

    I am trying to get some productivity numbers from a spreadsheet. I have 5 columns of data that are being looked at (Break, Kickout, Live-chat, Lunch, Restroom). I know what the threshold should be for each group. I can do it manually and I get the exact number I am looking for. The problem is getting Excel to see things my way. Here is an example of 100% productivity:(these are in seconds)1800 Break | 0 Kickout | 600 Live-Chat | 1800 Lunch | 300 Restroom1800+0+600+1800+300=4500So, for my basic formula it is easy -- 4500/(K2+M2+N2+P2+U2)That gives me a nice number to see how productive an agent was with their time.The problem I am running into is when someone does not work a full shift. If they come in for 3 hours of overtime, they will generally get a 15 minute break (900 seconds), and no lunch. So, instead of 4500 seconds allowed, it...
    This topic first appeared in the Spiceworks Community

    I am trying to get some productivity numbers from a spreadsheet. I have 5 columns of data that are being looked at (Break, Kickout, Live-chat, Lunch, Restroom). I know what the threshold should be for each group. I can do it manually and I get the exact number I am looking for. The problem is getting Excel to see things my way. Here is an example of 100% productivity:(these are in seconds)1800 Break | 0 Kickout | 600 Live-Chat | 1800 Lunch | 300 Restroom1800+0+600+1800+300=4500So, for my basic formula it is easy -- 4500/(K2+M2+N2+P2+U2)That gives me a nice number to see how productive an agent was with their time.The problem I am running into is when someone does not work a full shift. If they come in for 3 hours of overtime, they will generally get a 15 minute break (900 seconds), and no lunch. So, instead of 4500 seconds allowed, it...
    This topic first appeared in the Spiceworks Community

  • Help with excel, DSN name

    Hello!
    I have been searching this forum+google to fin how to acces an excel file.
    In some of the examples it says:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    c = DriverManager.getConnection("jdbc:odbc:Thename","",""); // TheName is the DSN name
    and I wonder what is "DSN name" how do I create that?
    Thanks in advance...
    /D_S

    Hello
    I have managed to create a DSN using controlpanel->Administration tools
    I have added a "System-DSN" named "Mymembers" which is going to work with my *.xls file "c:/mymembers/mymembers.xls"
    I get an error that says (my traslation)
    "Cant find the object 'mymembers'. Controll that the object exists and that the right searchpath are given"
    My syntax looks like:
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    c = DriverManager.getConnection("jdbc:odbc:Mymembers","",""); // Mymembers is the DSN name
    stmnt = c.createStatement();
    ResultSet rs = stmnt.executeQuery("select * from mymembers"); // mymembers is my sheet in mymembers.xls
    while(rs.next())
    System.out.println(rs.getString(1)+" "+rs.getString(2));
    }catch(Exception e)
    System.out.println(""+e.toString());
    finally
    try
    stmnt.close();
    c.close();
    catch( Exception e )
    System.err.println( e );
    ------------------------------------------------------------------------------------------------------------------

  • Help with excel

    Hi all ,
    i'm new to odbc .
    after 5 hours which i've tried to figure out how to do this , i'm turning to you experts.
    i got required from my manger project to make an option to an "end user" to use the option only thru the exce; , and not thru the odbc.
    the mission
    i got a text file which contain a complex query :
    select a,b,c,d
    from (
    select
    e,f,d,f
    from t)
    group by ....
    the goal is to take this file and to reload it into the excel.then make a pivot table.
    and then i guess to use the odbc ,
    the finale goal is then the user is entering to the excel and can run this query.
    for start please help me how to load this file into excel ,
    thanks in advance
    naama

    Well, the main problem is that what you're describing is connecting and running a query, which you need ODBC (or some other connectivity to the database) to do. Without that,the best you can do is run the query once, save the results into Excel, and let other people reopen whatever the results were back when you ran it instead of getting the most recent version.
    You can run your query in Excel by hitting Data (assuming you have 2007 or 2010), From Other Sources, ODBC. Connect to the database, and copy your query into the SQ window. Excel will go off and run it.

  • Help with Excel, ODBC and SQL

    I have an excel doc like this:
    A B C D E
    1 q w e r t
    2 t e s t
    3 s u p e r
    4
    5
    I have made the connection but I have problems with printing out the values. Could anybody give me a hint or 2
    Fore example how do I print out D3???? Or row 2???
    BR Soren

    you should check this article out :
    http://www.javaworld.com/javaworld/javaqa/2001-06/04-qa-0629-excel.html

  • Help with Excel for Mac

    I have Excel for my Mac & was working on a spreadsheet.  It froze & I force quit so it recovered the document.  When I finished working on the document I clicked to save the document & it asked if I wanted to replace it & I said yes.  It then told me that the document had an error  or was damaged.  Now I can't find it at all.  How can I recover the original document?  Thanks for any & all help.

    post in the office for mac forum: http://answers.microsoft.com/en-us/mac?auth=1

  • Help with excel grouped data and sorting to keep data intact

    I have a master spreadsheet with lots of data. I am trying to grouped the data based on physical address/city, add the values and once done sort it by valuation based on descending order by valuation but my data keep messing up.
    So in Row 1/col A: Address 1; Col B City: XXX; Col C: Valuation $$$
    Row 2/col A: Address 1; Col B City: XXX; Col C: Vauation $$$
    Row 3/col A: Address 2; COl B City: YYY; Col C:  Valuation $$$
    SO I sort by city and in ROw 1/2 same city with same address, I grouped it.  THen I created a new row below Row 3 and add up the grouped data (i.e. ROw 1 and 2).  I go through the entire list to finalize the grouped locations.  
    But when I am done and I sort by Valuation, all my data messed up coz I created a new row with addition of grouped location valuation and the formula gets messed up.
    Any one with ideas please help.  My deadline for this project is just a week away and I am freaking out.
    THanks in advance.

    it seems upload a sample is more clearly about the required.
    KR

  • Help with using MACROS for mac

         I have a serious issue and not sure if Im in the right place. i just started school. I am try to using the riverpoint writer on my mac, but for some reason it keeps saying that it cant load visual basic for application. Has anyone had this problem and if so can you tell me how you resolved it. that you for your help in advance.

    I must say sir I went thru it trying to get something that worked with riverpoint writer. And guess what I had to do in order for it to work on my macbook. REINSTALL OFFICE FOR MACS, thats all. Now its up and running and I am please, after searchin and spending unneccesary money on products that I did not need after all. Thank you for steering me wrong, to where I almost gave up.

  • Help with excel import...

    Hi all, I have imported a spreadsheet from Excel and unfortunately have four errors, one is detailed here:
    "TEXT" is an unsupported function.  The last
    calculated value was used.  The formula
    "=CONCATENATE("OF£", TEXT('Calculations'!
    G11,"##"),"PER SHARE")" couldn't be
    imported
    As I am new to numbers can anyone here explain what I need to do to make the concatenate work in numbers please?
    Thanks

    Hi Dana,
    Try this:
    =CONCATENATE("OF £",Calculations::G11," PER SHARE")
    OR
    =CONCATENATE("OF £",ROUND(Calculations::G11,2)," PER SHARE")
    Both depend on the calculation bing done on a separate table named "Calculations", located in the same document. For a case where the result in Calculations::G11 is 123.456, the result in the cell containing the formula should be OF £123.456 PER SHARE for the first formula and OF £123.46 PER SHARE for the second.
    What were the other errors?
    Regards,
    Barry

Maybe you are looking for