Application Workbooks V WBNameOutPut Activate alternative

0 votes

I use this piece of code:

Application.Workbooks(V_WBNameOutPut).Activate

I have the following code for calling a function and duplicating the above line's borders and orientation. How can I change the code so that I may enter alpha numeric values in that cell as this only accepts numeric values?

Feb 18, 2023 in Others by Kithuzzz
• 38,000 points
277 views

1 answer to this question.

0 votes

You can capture the workbook when it's opened and you don't have to worry about the extension after that.

Sub Test()

    'Open the first workbook and store reference to it.
    Dim wrkBk1 As Workbook
    Set wrkBk1 = Workbooks.Open("H:\Darren Bartrup-Cook\Test 1.xlsx")
    
    'Open the second workbook and store reference to it.
    Dim wrkBk2 As Workbook
    Set wrkBk2 = Workbooks.Open("H:\Darren Bartrup-Cook\Test 2.xlsx")
    
    'Copy/paste from wrkbk1 to wrkbk2.
    wrkBk1.Worksheets("Sheet1").Range("A1").Copy Destination:=wrkBk2.Worksheets("Sheet1").Range("A4")
    
    'Create a new sheet in wrkbk2.
    Dim NewWrkSht As Worksheet
    Set NewWrkSht = wrkBk2.Worksheets.Add
    NewWrkSht.Name = "My New Sheet"
    
    'Paste copy/paste values from wrkbk1 to wrkbk2.
    wrkBk1.Worksheets("Sheet1").Range("A2").Copy
    NewWrkSht.Range("A5").PasteSpecial Paste:=xlPasteValues
    
    'Make A3 in wrkbk2 equal the value in wrkbk1 A3.
    wrkBk2.Worksheets("Sheet1").Range("A3") = wrkBk1.Worksheets("Sheet1").Range("A3")
    
    'Close the two workbooks.
    wrkBk2.Close SaveChanges:=True
    wrkBk1.Close SaveChanges:=False
    
End Sub
answered Feb 18, 2023 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
0 answers

How to handle large http response data from observer in Angular application to avoid browser crash?

Suppose we have a angular application which ...READ MORE

Apr 19, 2019 in Others by Hemant Gajbe
2,591 views
0 votes
1 answer

How to include/ install any library in node.js application program?

Node.js is server side runtime environment that ...READ MORE

answered Jul 26, 2019 in Others by ArchanaNagur
• 2,360 points
1,588 views
0 votes
1 answer

Launch the DevTools application server in Flutter.

Hi@akhtar, After installing the DevTools in your Flutter ...READ MORE

answered Sep 10, 2020 in Others by MD
• 95,460 points
429 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
1,211 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
3,662 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
906 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
1,053 views
0 votes
1 answer

Excel: change the spreadsheets from templates to workbooks?

The extension is the only distinction between ...READ MORE

answered Oct 1, 2022 in Others by narikkadan
• 63,600 points
435 views
0 votes
1 answer

Embedding an excel document into an application with excel online

You have to do the heavy lifting ...READ MORE

answered Oct 2, 2022 in Others by narikkadan
• 63,600 points
883 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP