Posts by michibahn

    Hi All,


    Anyone here can help on a VBA script to copy 1st and 2nd sheet from a closed workbook to currently opened workbook overwriting and contents of sheet 2 and 3?


    The 1st and 2nd sheet names of the closed workbook changes dynamically so please don't rely on the sheet1 and sheet2 names.


    The 1st sheet of current opened workbook that will be copied onto is static and contains all the formulas and calculations based from sheets 2 and 3 on the same opened workbook. The sheets 2 and 3 contains the contents from sheet 1 and 2 from the closed workbook.


    Appreciate your help in advance.


    Thanks!


    EDIT: cross posting it also here to get a solution >> https://www.mrexcel.com/forum/…ntly-opened-workbook.html

    Re: Modify my code to copy ranges to email


    Quote from ashu1990;745975

    this codes copy charts into email body, hope you will be able to ammend it into yours for your better learning.


    Code
    Sub CopyAndPasteToMailBody()
        Set mailApp = CreateObject("Outlook.Application")
        Set mail = mailApp.CreateItem(olMailItem)
        mail.Display
        Set wEditor = mailApp.ActiveInspector.wordEditor
        ActiveChart.ChartArea.Copy
        wEditor.Application.Selection.Paste
    End Sub



    thanks ashu... I have actually tried that but unfortunately if I insert it to my existing code, it opens up 2 new emails.. 1 for my original code and 1 for the chart :( i'm really not good in VBA and i'm hoping someone can help me out..

    Hi Guys,


    I have the code below to email the results of whatever data is on A3 and B3 if I typed "Y" in M3. It will open up an email body using the Subject line on M2 and using the email address on M1


    I'm planning to add a chart which I will place somewhere in A20 as part of the email. I realized it will be easier for me if the code will just copy whatever is on column A upto J and rows 1 to 100 including charts, pictures etc...


    Is this doable? Thanks in advance!


    Re: Copy Formula and Output from 2 different excel file


    Thanks for your usual help. I tried replacing the myForm but end up getting error on.. myRange.Formula = myForm & "*" & myMult


    Any ideas?



    Quote from Luke M;726395

    You need to change the myForm variable then.

    Code
    myForm = "=IFERROR('[Book1.xls]Concentration Table'!C8+'[Book2.xls]Concentration Table'!C8,"""",)"

    Re: Copy Formula and Output from 2 different excel file


    Hey guys! Need your help again.


    How do I insert the IFERROR in my formula below? I want to get rid of the #VALUE! in some cells and put a blank space instead?


    TIA!


    Sub ne()
    Dim myForm As String
    Dim myRange As Range
    Dim myMult As Double
    myForm = "='[Book1.xls]Concentration Table'!C8+'[Book2.xls]Concentration Table'!C8"



    'Used Application.InputBox so user can select cells with mouse, rather than typing
    Set myRange = Application.InputBox("What cells do you want calculations in?", "Where to go", , , , , , 8)
    'Used Evaluate so user can type fractions, like 4/6
    myMult = Evaluate(InputBox("What should we multiply Book2's number by?", "Multiplier", 1))
    myRange.Formula = myForm & "*" & myMult
    End Sub

    Re: Copy Formula and Output from 2 different excel file


    Hi,


    Just reviving this thread to get some inputs in adding a pop up screen to enter a multiplier or expression in my macro. Basically, the macro below which adds the contents of cell C8 in Book1 and Book2. I need to add a multiplier in cell C8 of Book2 where in the pop screen will let me enter the multiplier or an expression.


    So the new formula will be C8+C8(any number or expression eg. 4/6)


    Any ideas?


    Sub ne()
    Dim myForm As String
    Dim myRange As String
    myForm = "='[Book1.xls]Concentration Table'!C8+'[Book2.xls]Concentration Table'!C8"


    myRange = InputBox("What cells do you want calculations in?")
    ThisWorkbook.Worksheets("Sheet1").Range(myRange).Formula = myForm
    End Sub



    Thanks!

    Re: Copy Formula and Output from 2 different excel file


    Quote from Luke M;720727

    I'd probably just write some formulas, or have the macro write the formulas to do the sum. Easiest way would be to open both file, write a formula like:
    ='[Book1.xls]Sheet 1'!A1+'[Book2.xls]Sheet 1'!A1
    Then close both the source workbooks. Formula in your 3rd workbook will now have full file paths. This is what you need to use either manually, or have the macro write. Then, if desired, do a Copy, Paste Specials - Values.



    Thank you so much Luke! However, is it possible to have an option that I can enter the Cell #s ranges where I want to copy formula in my new excel file?

    Hi Guys,


    I'm trying to create a new Excel Output File that contains the calculation taken from 2 different excel files.


    Basically, I want to output the result of the following:


    Excel File1 (A1) + Excel File 2 (A1) = Output File (A1)
    Excel File1 (A2) + Excel File 2 (A2) = Output File (A2)
    Excel File1 (B1) + Excel File 2 (B1) = Output File (B1
    and so on...


    Appreciate if you have any ideas on how to create a macro for this scenario to call Excel File1 and Enter A1 then Call Excel File2 and Enter A1 then Output in in the new Output file.


    Thanks!

    Hi,


    Is is possible to insert a custom label in duplicates after counting? I want to achieve Column D in the spreadsheet below:


    [ATTACH=CONFIG]51879[/ATTACH]


    A B C D
    [TABLE="width: 693"]

    [tr]


    [td]

    Shipping Name

    [/td]


    [td]

    Address

    [/td]


    [td]

    City

    [/td]


    [td]

    Count

    [/td]


    [/tr]


    [tr]


    [td]

    Black Badger (The)

    [/td]


    [td]

    55 Water St North

    [/td]


    [td]

    Cambridge

    [/td]


    [td]

    1 of 2

    [/td]


    [/tr]


    [tr]


    [td]

    Black Badger (The)

    [/td]


    [td]

    55 Water St North

    [/td]


    [td]

    Cambridge

    [/td]


    [td]

    2 of 2

    [/td]


    [/tr]


    [tr]


    [td]

    Charaka Kithulegoda c/o ING

    [/td]


    [td]

    3389 Steeles Avenue East, Suite 1100

    [/td]


    [td]

    Thornhill

    [/td]


    [td]

    1 of 1

    [/td]


    [/tr]


    [tr]


    [td]

    County Bistro (Blu)

    [/td]


    [td]

    92 King Street West

    [/td]


    [td]

    Cobourg

    [/td]


    [td]

    1 of 3

    [/td]


    [/tr]


    [tr]


    [td]

    County Bistro (Blu)

    [/td]


    [td]

    92 King Street West

    [/td]


    [td]

    Cobourg

    [/td]


    [td]

    2 of 3

    [/td]


    [/tr]


    [tr]


    [td]

    County Bistro (Blu)

    [/td]


    [td]

    92 King Street West

    [/td]


    [td]

    Cobourg

    [/td]


    [td]

    3 of 3

    [/td]


    [/tr]


    [/TABLE]


    TIA!

    Re: Search Macro to display all possible details


    Quote from PCI;639391

    What about next macro
    In the file attached use Control + G to launch it

    Code
    Sub In_Msg()
    Dim MyInfo As Variant
        MyInfo = Application.InputBox("Enter a reference to find")
        If (ActiveSheet.AutoFilterMode) Then ActiveSheet.AutoFilterMode = False '  REMOVE  AUTOFILTER  IF  EXIST
        ActiveSheet.Range("$A$1:$C$7").AutoFilter Field:=1, Criteria1:=MyInfo & "*", Operator:=xlFilterValues
    End Sub


    thanks a lot! the macro works but can the output be a popup window? also can the headers (Name data1 data2) be included the in output? thanks a lot again!

    Re: Search Macro to display all possible details


    Quote from PCI;639256

    Did you ever try AutoFilter and use Text Filters with Tek content


    I can use the auto filter but I want something easier for a not so techie user. that's why I thought of having a button search macro and popup output. Thanks!

    Hi,


    Can you please give me an idea how to create a macro that will display the contents of the entire row in reference to column A?


    Basically, in the data below, if I search for "tek" it will display all instances of the word "tek" from column a including column b and c.


    A B C
    Name data1 data2
    Tek 1 2
    Tekx 3 3
    Tekc 3 4
    Gup 3 4
    Gaz 3 3
    Gazc 5 5


    So my output popup would be like below. It should show the Column labels not just the contents
    Name data1 data2
    Tek 1 2
    Tekx 3 3
    Tekc 3 4


    Thanks in advance!