thisworkbook

  1. M

    maneuvering btwn workbooks with vba

    Struggling with "activeworkbook" vba. I have a spreadsheet with a button (who doesn't, right?). This button is supposed to take all of the .xlsx files, recognize the name, and save as pdf's to various destination folders on sharepoint/teams based on that name. Most of that actually happens...
  2. M

    Event Macro Not Calling Macro Or Crashing Excel

    I want to call a macro when a cell in the range H2:FAX changes (for all sheets), where X is the last row. However I can't get the event macro posted in ThisWorkbook to call the macro consistently. I did get it to work a couple times by chance, and it worked fine for a while and then suddenly...
  3. D

    ThisWorkbook

    Hello, I would like to change "namefile_2.xlsm" to ThisWorkbook in this line of code while maintaining the functionality. How can it be done in a simple way? Windows("namefile_1.xlsx").Activate Sheets("Sheet1").Select Sheets("Sheet1").Copy...
  4. D

    How to use VBA to close ThisWorkbook if the folderpath it's opened from is not the specified folderpath?

    Hi Folks, Have checked Google and come a blank on this one. Does anyone know if it's possible to use VBA---in a Private Sub Workbook_Open() macro---to check if the filepath that the file has been opened from matches a specified path, and if not, close the workbook? Kind regards, Doug.
  5. U

    keep thisworkbook as the workbook that is displayed after macro is finished running

    Hi all, I have created a code that copies data from one workbook (Workbook1) and pastes it into another workbook (Worbook2). The code works fine but after it is finished, it displays Workbook2 on the computer screen. I would like Workbook1 to be the workbook that shows up after the code is...
  6. B

    Open Outlook When Excel opens

    I have a workbook that has a few outlook functions built in to it but outlook needs to be open the way the codes are written. How do I get Outlook to open when this file opens? I know the code has to go in the ThisWorkbook section of the objects. Thanks in advance
  7. S

    How to combine two pieces of code on one spreadsheet

    Hello All, I have two pieces of code. The first is a "select and move" piece of code to take a line from one worksheet and transfer it to another worksheet dependent on cell content, it also unlocks and then locks the worksheet to perform this task. The second piece of code I have copied...
  8. Pinaceous

    ThisWorkbook Question

    Hi All, I'm trying to use a different code structure for the NAMED tab of "Tab_ONE" with the following: ThisWorkbook.Sheets("Tab_ONE").Range("B11:X180")) Is there anyway to restructure this to use the for example, Worksheet(2) in lieu of "Tab_ONE"?? Please let me know, if you should have...
  9. CsJHUN

    macro change back to "thisworkbook" from "active workbook"

    Hi guys, i have this (snipet): Private Sub readreqdb() Sheets("allrequest").Activate ActiveSheet.Unprotect Password:="asdqwe" dblink = Sheets("settings").Range("AG11").Value Workbooks.Open dblink, ReadOnly:=True, Password:="asdqwe" Set reqdb = ActiveWorkbook For i = 1 To Sheets.Count...
  10. E

    Simple Save As PDF code

    Hi, I(VBA novice) am looking for a simple save as PDF code to add in my excel sheet, using the ThisWorkbook. Thank you.
  11. W

    macro to fix macro?

    There is a spreadsheet that is print protected[indented for third party input directly into the sheet - like a questionnaire]. It was print protected in the "Thisworkbook" so that the 3rd part would need to populate it and return it electronically. However we shot ourselves in the foot as WE...
  12. M

    Closing ActiveWorkbook but not ThisWorkbook

    My program opens a spreadsheet. I want to close this one using the x symbol without asking me if I'd like to close all other spreadsheets. I have this written in my ThisWorkbook coding section. Public swb As String Private Sub Workbook_Open() Application.ScreenUpdating = False swb...
  13. P

    Unable to select a sheet while copy pasting data

    Hi All, Im trying to copy a data from 1st excel to 2nd excel. While im about to select a sheet in 2nd file im getting "Subscript out of range" as error. I have used the same code earlier for several other excels but I haven't get this kind of error. Can someone help me to fix this. Below is my...
  14. R

    Thisworkbook property

    In the below lines the first 6 and the 11th work, but lines 7, 8, 9 and 10 don't work Do you have to use Sheets when using ThisWorkbook [myrange] = "Yes" [myrange].Offset(0, 1) = "Yes" Sheets("Sheet1").[myrange].Offset(0, 2) = "Yes" Range("myrange").Offset(1, 1) = "Yes"...
  15. B

    Thisworkbook Object in VBE crashes Excel

    I have a new Lenovo i7 with 32 bit Office 2016. When I select Thisworkbook object in the VBE, Excel crashes. Searches have not found a solution and extracting to bas or cls files fail to import to clean wkb on selecting the object. Any solutions? Brendan
  16. MUKESHY12390

    Multiple workbook under one workbook

    Hi all, today I have observed strange thing, while writing code I usually see just one workbook ( Thisworkbook - with excel icon) under VBA project. I don't know what happened now I can see two workbook ( thisworkbook and Output workbook). it seems sheet got convereted into workbook. Is...
  17. L

    workbook vs thisworkbook and worksheets(1) vs activesheet

    Hi I understand I can replace worksheets(1) with thisworkbook in the code below. I checked both Workbook and Thisworkbook and I found they are not identical 100%. So how can I replace one with another if they are not identical. Is it technically ok to replace one with another or I should put in...
  18. L

    VBA environment and Module

    Hi I have excel 2013. When I click on Developer-->VBA, excel will open VBA environment. Under project, I see 2 entries 1) Sheet1 (Sheet1) 2) ThisWorkbook My understanding, if I want to write a code to run for ONLY sheet1 then I click on sheet1 and write the code. At same token, if I want to...
  19. L

    Recreating scripts to include ThisWorkbook with all ranges and worksheet calls.

    I have created a directory and it works great until you have it open with other documents... So I need to limit it to only this workbook but with the different types of script below I'm not sure how... It's not as simple as just placing ThisWorkbook in front of it... Any assistance on getting...
  20. Nelson78

    Copy a sheet from a closed workbook and paste on an existing sheet of this workbook

    Hello everybody. I need to copy the sheet ("Alpha") from the closed workbook ("Beta") and paste it in thisworkbook sheet ("Alpha"). Sub copy_alpha() Application.ScreenUpdating = False Set wb1 = thisworkbook Set file2 = Workbooks.Open("S:\xxxx\yyyyyy\Beta.xls")...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top