+ Reply to Thread
Results 1 to 8 of 8

How to open,copy and save as .. lookiing help on a samll macro for creating report

  1. #1
    Registered User
    Join Date
    08-11-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    22

    How to open,copy and save as .. lookiing help on a samll macro for creating report

    Hi Guys,

    I am working on a macro and looking for little help on completing that macro. I am looking for help on below task.

    I want to have three files under my macro

    File 1 - First Spreadsheet would be carrying my macro under a command button would be give to perform the task.On Clicking the command button the input file would be open ,perform the diffrent function and save the new file using saveas option for giving location to save new file.


    Capture_macro.JPG
    file 2 - File 2 - Input FIle

    Capture1.JPG

    FIle 3 - OutPut file
    Capture_Output.JPG
    Through macro file, i would firstly browse the input file and after that it would create a new workbook with data of TV from input file by filtering on raw file and with extra column of result which going to reflect the multiplication of qty and price. It would also highlight the row whose result comes above 100. And at last that it ask us to save the output file.


    I have attached my images, input file and output file for reference.

    Input_FIle.xlsxOutput_File.xlsx

    Please help me on this.

    I am new on vba so still learning.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    why not attach a xlsm file with your macro ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    08-11-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    Hello Sir,

    I am new on VBA so i know about getting the data from open worksheet, but now i know want to learn about getting data from closed workbook , create new file and then save new file at new location. And all i want to do these things ,with open and save as dialog box . Because of same i have no code file for this stuff.

    Hope you can help me to learn this stuff by provide me code for doing this job.


    Thanks
    Satish

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    you don't need macro for this job, put a formula for result and use filter for product

  5. #5
    Registered User
    Join Date
    08-11-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    Hi ,

    I want to automate my some daily jobs with VBA, and most of jobs include above stuff. If you could help here on this that would be highly appreciable. By learning i would be able to automate my jobs. So please help me to learn this stuff.

  6. #6
    Registered User
    Join Date
    08-11-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    Hi All,

    For above task , i have written below code, could someone plese help me to complete as i am getting error "out of range " on code line before applying filter.





    Option Explicit

    Sub mvcheck()

    Dim fd As FileDialog
    Dim filechosen As Boolean


    Set fd = Application.FileDialog(msoFileDialogOpen)

    fd.Filters.Clear
    fd.Filters.Add "2003 File", "*.xls"
    fd.Filters.Add "2007 & above File", "*.xlsx"
    fd.FilterIndex = 1
    fd.AllowMultiSelect = False

    fd.Title = "Select MV File"
    ''fd.Button = "Run Rec"
    filechosen = fd.Show

    If Not filechosen Then
    MsgBox " Kindly select your file "
    Exit Sub
    End If
    fd.Execute

    Application.ScreenUpdating = False


    ''Workbooks(filechosen).Sheet1.Activate

    With Workbooks(filechosen).Worksheets("Sheet1")
    .Range("$A:$D").AutoFilter
    .Range("$A:$D").AutoFilter field:=3, Criteria1:="Loan"

    Range("A1").CurrentRegion.Copy

    Workbooks.Add

    Worksheets(1).Activate
    Range("A1").PasteSpecial

    With Intersect(ActiveSheet.UsedRange.EntireRow, Range("E:E"))
    .FormulaR1C1 = "=RC[-1]*RC[-3]"
    .Value = .Value
    Range("e1").Value = "Result"
    End With

    End With

    End Sub

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-11-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    Thank you patel45.
    Last edited by satishdu; 05-25-2014 at 01:29 PM.

  9. #9
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How to open,copy and save as .. lookiing help on a samll macro for creating report

    Please Login or Register  to view this content.
    Last edited by patel45; 05-25-2014 at 01:48 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to open workbooks, process data, save copy as a csv
    By jdgwebdev in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-13-2013, 01:09 PM
  2. Creating a Macro to save a copy before close
    By MRX813 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 01:04 PM
  3. Replies: 3
    Last Post: 09-08-2012, 07:52 PM
  4. [SOLVED] Creating a macro to open as save other selected Excel sheets
    By Wessie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 04:40 AM
  5. [SOLVED] Creating an excel macro to open and save sheets to a different directory
    By sem in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-29-2005, 03:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1