why the "apply to all worksheets" portion of this code is not working? I appreciate your time.
Sub Delete_0activityaccount() ' ' Dim mywSheet As Excel.Worksheet For Each mywSheet In ActiveWorkbook.Worksheets
lastrow = Cells(Rows.Count, 1).End(xlUp).Row For i = lastrow To 8 Step -1 If Cells(i, 4).Value = 0 And Cells(i, 5).Value = 0 And Cells(i, 6).Value = 0 And Cells(i, 7).Value = 0 And Cells(i, 8).Value = 0 _ And Cells(i, 9).Value = 0 And Cells(i, 10).Value = 0 And Cells(i, 11).Value = 0 And Cells(i, 12).Value = 0 _ And Cells(i, 13).Value = 0 And Cells(i, 14).Value = 0 And Cells(i, 15).Value = 0 And Cells(i, 16).Value = 0 _ And Cells(i, 17).Value = 0 And Cells(i, 18).Value = 0 Then Rows(i).Delete Else End If Next i
I need to run a loop through a column of values (attachment col B) and when it finds a "J" it will apply conditional formatting to a row of 4 cells directly adjacent. The attachment is a theoretical before & after.
I have a workbook that contains 168 sheets of data (it's an extract from a PM tool) which is effectively a status report from each project in our portfolio. Contained within each status report are some financial data that shows a Plan number and a Forecast number for which I want to apply conditional formatting to this section (this is the same section for each sheet), to all the 168 sheets without having to go individually into each sheet. I have searched here and all the varying responses to a similar situation as mine, do not cater for the number of sheets that I have. And I need to do this on a monthly basis at monthend. So in the example below I want to apply conditional formatting if the Forecast (Cols D & G) are greater than Plan (Cols B & E). Is there a way of doing this just with the conditional formatting or would it need a VBA script?
Col A Col B Col C Col D Col E Col F Col G Financial Summary - Selected Project Currency: USD
I have a macro to loop through all the sheets in a workbook and apply a filter in column C. the filter is by Date and all sheets have the exact same format. For some reason the macro will go through the loop but not change to the next sheet. The message box line however does go from sheet to sheet.
I attached a 2 tab work book example. When i run the program, it only applies it to Sheet 1.
I am trying to apply a double click event to all sheets. It works if I apply to each sheet but I won't to prevent from having to copy and paste into each new sheet. I am trying this code in ThisWorkbook but doesn't seem to work.
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) ' If the cell is clear If Sh.Target.Interior.ColorIndex = xlNone Or Sh.Target.Interior.Color <> vbCyan Then ' Then change the background color to yellow Sh.Target.Interior.Color = vbCyan
I am trying to loop through all of my worksheets in my workbook to apply a subotal to each of the sheets. I can get it to work with applying to just one named sheet, but I cannot get the loop to work. The sheets named "data" and "PriceList" do not need the subtotal applied.
Below is the code I am using:
Sub SubTotals() Dim LastRow As Long Dim wsDst As Worksheet
I havae the following macro which i recorded in Excel. I want this Macro to run after another macro that groups data and creats tabs. The following macro will then add a column and run an array formula. I think this can be done in a loop but i'm not sure how to do it. This is working but takes a long time and times out by the time it reaches the last tab.
I'm trying to go through a workbook and, based on some user inputs, hide certain sheets and charts (these charts are their own tab, i.e. a chart object). Here's a sample code I wrote for a dummy workbook I have. Unfortunately it doesn't work, I think because the loops are nested. However if I can figure out how to fix this code I can easily adapt it to my other real problem.
I have a workbook with many sheets, basically all the sheets are almost the same template with fill-in information for different type of jobs, and for the most part, the information is located in the same areas in each sheet.
I need to look in each sheet for a cell labeled, Committee ID:
And then copy it and the cell to the right of it, so for example:
A8 hasCommittee ID: B8 hasC1234N
So, loop through all the sheets and get these values and then paste them into a new sheet in the same workbook and call that sheet Report. When pasting data into the Report sheet, insert a space between each result.
to perform find, if match, ubdate, looping action in various sheets of excel through VB.
Currently, i am working at WAREHOUSE, where not having SAP OR ERP to perform [ maintain ] each & every in & out movement of products. However, i have been using excel to put in values for in & out manually....
The data to be filtered is in several sheets, and once filtered is to be copied to a destination sheet (in this case "Temp"). The criteria for advanced filter is on an altogether different sheet (in this case "Reports"). The macro is actually simplified for the purpose of the question, and I want to re-use the code several times, hence the use of variable "filterRng". When I run it, I get the subject error at the bolded line in the code below. I'm thinking that the Advanced Filter doesn't like a variable as a range reference, as it runs perfectly well if the commented out line below the problem line is used instead.
Dim i As Integer Dim rngData As Range Dim filterRng As Range
Set filterRng = Sheets("Reports").Range("A121:K124")
I have a matrix of coordinates in sheet ("layout") (eastings - V4:BR4, northings - U5:U100). I'm trying to run through each northing (row value U5:U100), for every easting (V4:BR4), by writing the coordinate value to sheet("ISO_model"), cell K18. Within the sheet (ISO_model) there is a model which gives an output in cell HA500. I'd like to write this output (for the specific easting and northing) back into the sheet ("layout"), so that I then have the x,y, z values to create a contour plot.
I've tried to start the look through the row of eastings, but it is not working.
Sub noise_contour() For Each Cell In Range("V4:BR4") 'write coordinate into the model
I have written a number of macros, and I typically use Application.Screenupdating = False at the start, and set it True at the end of each macro. However, I now have some big macros which call others as subroutines. This results in the screen updating for each pass thru a called macro, as the Application.Screenupdating = True statement is executed. Is there a means to repress this at the top level, or is there a better approach to take in writing code which will stop screen update for a macro, but not restart it each time the macro is called as a subroutine?
I have a very vast code with several subroutines based on selections from a userform.
I believe I have identified a loop that might be slowing down the process in the below:
Code: Dim n As LongFor n = 23 To 65 If ThisWorkbook.Worksheets("record").Cells(ComboBox2.ListIndex + 3, n).Value = "INT" Then UserForm2.ListBox2.AddItem ThisWorkbook.Worksheets("record").Cells(2, n).Value End If If ThisWorkbook.Worksheets("record").Cells(ComboBox2.ListIndex + 3, n).Value = "EXT" Then
Basically the code will go through each value (that can be only of those four instances) and put the title inside a different listbox.
This works, but it seems to be maybe too "step by step" and direct? Is there a way for it to skip after it found the corresponding value to the next N without checking for a match with the other items?
As you can see below, I've written code that writes random numbers into three columns of a spreadsheet (10 numbers in each column).
What I want to do is create code that will run the random number generator for a period of 1 minute and then stop. I know that I will need to write a timer subroutine to do this but I'm how unsure how to do this.
My problem today, is actually being able to call the routines. I have tried to make a generic setup, so that each subroutine to be called is named "Macro_[number here]". So Macro_1, Macro_2 etc. By doing this I am hoping to be able to call all the subroutines using a For Each code.
I am trying to record a macro that edits a rows data, and simply copies it to a new cell further along on the same row,. but i then want it to move to the next row down, and apply the same macro to that run, and continue until there is no data in the last row,. How do I get the macro to continue to the end of the data.