• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Search results

  1. Stevie

    VBA to save word doc in directory.

    Hiya Mike, according to the Microsoft docs site here, you need to use something like: ActiveDocument.Shapes(1).TextFrame.TextRange.Text = "My Text" So, depending what the shape index is (or name) in your document, your code should look more like: filename = Shapes(1).TextFrame.TextRange.Text...
  2. Stevie

    Auto insert text in a new created cell when inserting a new row

    A clever way to detect the insertion of cells (with a test for if this insert is a whole row) is included in post #4 at this link. It covers inserting from the command bar, and from the right click menu. You could disable calculation and enter your "SET_UP" string in the appropriate location...
  3. Stevie

    vba - two different loops into Single Loop....

    Hi Malleshg24 your query appears to have fallen through he cracks somewhere so I took a few minutes to look at it today. I have modified your first macro to perform both tasks in either order exactly once on a dynamically sized data-set. It is unclear from your query if you want it to work this...
  4. Stevie

    VBA to hide worksheets when file saved as .mht

    Hi Sam, the below seems to work specifically only for the extension you specified, but when doing an input such as 'test.xlsx' it causes an error. I suspect this is something to do with compatibility with vp project code, but i'm not sure. - I fixed the recursion issue quite simply, I was...
  5. Stevie

    VBA to hide worksheets when file saved as .mht

    Hi Sam, I have not solved your problem, but I spent some time thinking about it and my work may help you get closer to a solution. The problem as I see it is that if you use BeforeSave (as per your example), you cannot capture the new filename or extension and therefore cannot run your check...
  6. Stevie

    Clicking a button via IE automation VBA

    Hi AV114 I'm not sure how you would 'click' the button, but perhaps just running the script which the button runs would work? Something like: IE.document.all.Item Call IE.document.parentWindow.execScript("fnXlExport('myTable', 'myExcel')", "JavaScript") Where IE is the webpage object. I found...
  7. Stevie

    Restrict workbook open in existing excel instance

    Hi Inddon, I am not sure that you can be that specific around the opening of workbooks. If you can, then I am not sure how it would be done only for workbooks opening in a different instance as you mentioned in your second comment. Stevie
  8. Stevie

    Restrict workbook open in existing excel instance

    Hi inddon you should be able to capture another workbook being opened with WindowDeactivate and prevent it there if it has the wrong name perhaps. In Thisworkbook: Private Sub Workbook_WindowDeactivate(ByVal Wn As Window) Dim SecondWB As String SecondWB = "Workbook2.xlsm" If...
  9. Stevie

    Extract data from website

    Based on the above conversation, it appears that my original method may be your only option. As you have a working solution from my first reply and can set the IE window to be not visible should you need to, I would suggest running with that. As Chihiro said, it's a simple change: IE.Visible =...
  10. Stevie

    macro code arrangement for title extraction and google link

    Hi stefan, I had a look around, finding that the below helped one user with the same problem: try replacing the line: Set XMLHTTP = CreateObject("MSXML2.serverXMLHTTP") with the line: Set XMLHTTP = CreateObject("MSXML2.serverXMLHTTP.6.0") Stevie ^.^
  11. Stevie

    readonly excel for specific users and full access to other users

    Hi akika, I assume you mean something like this: Sub a() Dim numusers As Double Dim permoption As String numusers = Sheets("Sheet2").Range("A1").End(xlDown).Row permoption = Application.WorksheetFunction.VLookup(Application.UserName, Sheets("Sheet2").Range("A2:B" & numusers), 2...
  12. Stevie

    Extract data from website

    Hi inddon, I had a go and managed to get a defined tracking number to output as you requested. I fell into an error when attempting to deal with the 'Sign up for our Newsletter' pop-up. This may not be an issue for you if you system is signed up already? Regardless, this worked for me and should...
  13. Stevie

    Combine all possible combinations from single column in msaccess

    Hi Sriram, Hui's code will produce the results you are looking for, but it may be worth considering the requirements at a higher level. What will you be using these pairings for? I ask this as 9148 C 2 = 41838378 (9148 P 2 = 83767756 if order matters! - it seems to in your example), which is a...
  14. Stevie

    Multiple Regression using Categorical Variables

    Hi j4k3, when I personally am trying to debug things like this, I try to go back to the simplest form and check that that is working as intended. I would suggest manually loading some variant objects with known y and x values and doing a quick test in the form below: Dim instance As...
  15. Stevie

    Toggle suffix value of selected cell or cells

    Hi Frisbeenut, try this: Sub frisbeenut() Dim checkStr As String Dim cell As Range Application.ScreenUpdating = False checkStr = " (est.)" For Each cell In Selection If Len(cell.Text) > 0 Then If Right(cell.Text, 7) = checkStr Then cell =...
  16. Stevie

    Toggle suffix value of selected cell or cells

    Hi frisbeenut, try this: Sub frisbeenut() Dim checkStr As String Dim cell As Range Application.ScreenUpdating = False checkStr = "(est.)" For Each cell In Selection If Len(cell.Text) > 0 Then If Right(cell.Text, 6) = checkStr Then cell =...
  17. Stevie

    Need advice with manuals and instructions

    Hi ham123, I would first point out that this is the VBA section of the forum and so if you are trying to avoid using VBA, then this is perhaps the wrong place to ask the questions. That being said, each one of your items above are relatively discrete problems each with solutions which can be...
  18. Stevie

    Macro record for correction

    Hi Thomas, please try the below: Sub Thomas() Dim mnths As Variant, mnth As Variant, length As Double, copyrange As Range length = Sheets("Summary").Cells(Sheets("Summary").Rows.Count, 2).End(xlUp).Row Set copyrange = Sheets("Summary").Range("B4:B" & length) mnths = Array("Jan"...
  19. Stevie

    Search for X number in a list and return numbers below it.

    Hi dwrowe001 I have not looked at your files, but this code does what you described: Sub dwrowe001() Dim searchNum As Double Dim offsetNum As Double Dim outputString As String Dim searchRange As Range Dim c As Range searchNum = Sheets("Sheet1").Range("A1").Value 'set this...
  20. Stevie

    How to understand each line of VBA code

    No worries.
  21. Stevie

    How to understand each line of VBA code

    Continued: Further than this I cannot tell from the code, and should my explanation be insufficient, I would suggest that perhaps this code is too advanced for you and you would benefit from doing some learning on VBA and programming in general. Each of the functions and attributes which you...
  22. Stevie

    How to understand each line of VBA code

    Hi Anbuselvam, If Target.Count > 3 Then Exit Sub This prevents the code from running if the user's selection is more than 3 cells. K = 7 In the code you pasted above, it is k=8, but either way, k is a variable used to store the row where data is inserted later on in the code: lines 23-26 In...
  23. Stevie

    Lotus Notes Email Macro

    I also do not have Lotus Notes and cannot test, but when I have used Excel with Lotus Notes in the past, I successfully used this: https://www.rondebruin.nl/win/s1/notes/notes.htm as reference. I hope it helps you. Stevie
  24. Stevie

    How to DISABLE unused bookmarks in WORD

    Hi Rahul, you have not posted the most relevant part of your code which cycles through the bookmarks and relates them to the range you are copying. That said, from what you have posted, i'm struggling to see why you can't just skip the bookmark you have no data for: If Sheet.Sheets("Weekly...
  25. Stevie

    help to make a maro to delete first 4 row on multiple file

    Hi Maxwolf, the below code should open all workbooks in a folder you specify, 1 by 1 and delete the contents of the first 4 rows before saving and closing that workbook. If instead you want to delete the rows entirely, replace 'clearcontents' with 'delete'. Please be very sure that you know...
Back
Top