ws.name

  1. B

    If sheet title is NOT this Monday's date then execute code

    Hi all, I've tried out a few approaches and haven't been able to solve this issue so I defer to your knowledge. I have a number of worksheets which are titled as the week commencing date in the following format "dd.mm.yy", in other words, each sheet's title corresponds to the date of each...
  2. S

    Helping a New VBA User With Efficiency in VBA

    I am a beginner to the world of VBA. I am attempting to automate a spread sheet that receives data from multiple, fluctuating tabs. I have created the code below but it basically is just inputting formulas in each cell that then calculates as though they were manually entered into each cell. Is...
  3. C

    Problem Cycling Through Worksheets VBA

    I'm pulling my hair out trying to figure out why this isn't working. I run the macro from Sheet2 and it just ends up clearing everything on that sheet rather than on the ws that's up in the rotation. It will work if I activate the ws first, but that doesn't seem like the best solution. Please...
  4. bobkap

    Loop thru sheets

    I cannot get this code to run except for my active sheet. I will not sequence to the next sheets in the workbook. Any help would be greatly appreciated. finalcol = Cells(1, Columns.Count).End(xlToLeft).Column finalrow = Cells(Rows.Count, 1).End(xlUp).Row For Each ws In ThisWorkbook.Worksheets...
  5. A

    convert Chart to picture

    I need to generate a report by pressing a button. I use VBA to extract worksheets to a new workbook using a button a lot, but this one I can't figure out. What I would like is for the 2 charts on the active sheet to not be charts with links on the new sheet (so the report that can be provided to...
  6. R

    Running code on all files from a folder

    Hello Guys, I would like to run this code on all files from a specific folder. Someone could please help me? Best Regards, Rafael Fernandes Code (from Tommy Miles of Houston, Texas): Sub SplitWorkbook() Dim ws As Worksheet Dim DisplayStatusBar As Boolean DisplayStatusBar =...
  7. H

    Edit to VBA code used to return worksheet location.

    Hello, I am currently using the below code to return the worksheet location of over 11,000 part numbers in a spreadsheet with 45 worksheets. Sub test() Dim a, i As Long, ws As Worksheet, r As Range With Sheets("Location_Summary").Cells(1).CurrentRegion .Columns(3).Offset(1).ClearContents a =...
  8. M

    Printing multiple sheets at once, plus some options

    I have a macro below that I've used to try to print multiple sheets in a single print job. There are 11 sheets that I do not want printed, and all of the others need to be printed. The remaining sheets that are to be printed are all formatted with the same print area, each is 2 pages...
  9. B

    Hide blank sheets that do not have an object embedded

    I wonder if anybody can tell me if this is possible I have a workbook with a few blank sheets; these are used to embed pdf documents if required. However I would like to is run some code to hide the empty sheets if there has not been a pdf document embedded within that sheet. Below code will...
  10. B

    VBA Run-time error 13 - Renaming Worksheets from range

    Dim ws As Worksheets For Each ws In Worksheets For z = 2 to 26 If ws.Name <> "Template" And "Rota" Then ws.Name = Cells(1, z) End If Next Next The red is the offending line. All I'm trying to do is rename each worksheet after each cell in B1:Z1 (There is the same no. Of...
  11. N

    Help to Call Sub or Function with conditions

    Hi all: I want to have macro that Call al ot of Sub/Functions with conditions: Left(ws.name,4) = "AAA0" and ws.range("A2").value <> 0 When conditions match will Call Sub Filter_ & ws.name For example: if ws.name = "AAA012345" and sheets("AAA012345").range("A2") <>0 then Call Filter_AAA012345 I...
  12. S

    Looped ifs through multiple sheets (Nested loop?)

    Hi All, I'd be grateful of any help in getting a looped command working across multiple sheets. I think I'm close to getting this, but when I run the below it only performs the column hides on the last associated worksheet - it isn't applied to all worksheets (ignoring those excluded). Dim ws...
  13. E

    Merge data from all bar 2 sheets

    Dear All I am trying to copy data from all sheets in one workbook but NOT copy from the HOME sheet and the Prog_Dep sheet, here is my code it copies but also copies these two sheets that I do not want it too. Sub CombineData() Dim ws As Worksheet For Each ws In Worksheets If ws.Name <>...
  14. M

    Print All, Except

    I want set a macro to print all tabs of a workbook, except for the first 3. The first 3 never change, so I know their names, but they're length does, so it's difficult to use code that starts printing on a particular page, in case one of the first 3 takes up a different number of pages than it...
  15. B

    Routine for the cursor and scroll position and also hide the blank rows.

    Hi Excel Gurus, Once again I am very much thankful to this community due to which I learned a lot. I am stuck in the current routine although it is not giving any error and executing but its not hiding the rows as mentioned which are blank has no data. To be more precise I have selected the...
  16. M

    Looking for an easier way to write this For Each loop. Perhaps with a case statement?

    We have two groups of employees, and they need different handling for payroll. To loop through 1 type of employee, I simply excluded the others in my For Each statement, because there are only a few. For that second group though, it is inefficient and unwieldy to exclude an entire list. (Every...
  17. H

    Copy Data based on region to relevant sheet name

    I have various sheets from sheet 5 onwards based on the unique region name in Col A on sheet1. Have a macro to create these sheet names I have region names in Col A on sheet1 ("customers") from row 12 onwards and headings in row 11 I have a macro to copy all the data from row12 onwards based...
  18. G

    Workbook Open Code Not Working

    Hello all, I am getting an error when I open a workbook. In a nutshell, for each sheet not named one of the sheets in the code I want to activate that sheet and add the months of the year in the combo box. Each sheet has a combobox1 on it, so I'm not sure why this isn't working. Any help is...
  19. R

    Clear Contents on Multiple Worksheets

    I'm trying to clear the contents on multiple worksheets, from row 2 through the last row. I'm running into an issue where I'm trying to skip the worksheet if row 2 is already empty. Here's my code. I'm getting a Next Without For error message. Sub ClearData() Application.ScreenUpdating =...
  20. M

    Change this line of code

    Hi all I have created a loop to go though all sheets except a few but im concerned that more sheets might get added where ill need to ignore them so i have created a range on my refsheet that list all the sheetnames i want to loop through and NOT avoid how do i change this line of code: dim...

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