I am trying to copy first 200 sheets with same format to another workbook with each of the copied worksheet to have their own tab with the same sheet name.
I am not expert in VBA so I have tired many vba script found using google but can't figure it out.
In my excel there are about 1200 sheets...
Is there a way to apply code to all slicers at once, without having to call out each slicer cache and each slicer item in each of those caches?
I have 4 slicers, each has 2 - 104 items in it.
I would like to run some code so that when all items for all caches are TRUE, then data labels are...
Hi all,
I am having trouble in the below code its keep getting me error on line
rst.Fields(Cells(1, i).Value) = Cells(x, i).Value
i dont know what the problem is please help me out.
the complete code is here
Sub Export_Data()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim dbPath...
I have a UDF that I wrote .... nothing fancy, but I could sure use some help cleaning up. It is very basic and I am not 100% sure where or how I should clean it up so that it is easier on the eyes, easier to follow (doesn't make one cringe just looking at it), better coding...
I want to add a line of code to my VBA to copy only the values of column B with no formatting.
Part of my code looks like this:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit...
I have a workbook with several sheets that I have specified ranges for starting in A3 (same on every sheet) through column Q (row count varies). I have a sheet in the workbook that has all of the named ranges listed out in column A. I would like to write a macro that will look on sheets "Ranges"...
Hello!
I am trying to write some code so that a vlookup is automatically performed when a change is made to any cell in column A of a specific worksheet.
Also, if the vlookup returns N/A, I want to leave the output blank, instead of N/A populating.
2 Worksheets, same Workbook:
Population
&...
Hello,
I have a variable number of columns. Column N is where I need the product of Columns L and M. I also have a variable number of rows for Column N to fill.
I have no idea how to even begin to write this.
I have this so far but it doesn't even begin to work.
Dim lngLstCol2 As Long...
So I am new to VBA and I created a hyperlink that will take me to another page if it is selected. It will also tell me which cell was selected (which is important). However, it was way to big and I am stuck. It begins on 162 and goes to 344 and also needs to go from column J to column DD...
I am trying to remove all named ranges/defined names in my workbook.
I was pretty sure that it would be simple.
I am using the following code:
Sub DeleteNames()
Dim xn As Name
For Each xn In Application.ActiveWorkbook.Names
xn.Delete
Next
End Sub
However, I get an error message:
I...
Good morning All,
I am not in any way good at writing a new macro but i am "okay" at manipulating several macros to do what i want, i understand the simple side of macros but after frankensteining a macro together it seems to run horribly slow with certain changes to the code ...... surprise...
Hi All,
I am new user and I have some similar requirement. I need permutation of A, B, C and D but I also need to specify maximum how many times each letter can occur.
i.e I need A to appear max 4 times, B 2 times, C 2 time and D 2 times. Valid examples AAAA, AAAB, AABB, AACC, CCDD (since...
Hi all,
I am looking for some VBA to do a find/replace that can be applied to a defined a range. I would prefer not to have to reference a new worksheet/table if at all possible.
The characters I am looking to find/replace are:
Find What: *
Replace With: %
Find What: ?
Replace...
I have a Do until statement wrapped in an If statement and this is the Do until code I am using: DEPI = Sheets("MTN").Range("A1").End(xlDown).row Set findrange = Sheets("MTN").Range("A1:A" & DEPI)
Set foundcell = findrange.Find(What:=Sheets("MTN").Range("C1").Value, LookIn:=xlValues...
EDIT: Sorry, the title should have read:
"Referencing Closed Workbook via Open Workbook's external links - VBA"
---------------------------------
I have some code in WorkbookA where I ask for the location of WorkbookB (the data and location constantly change). Via a prompt I am able to select...
So I have some code located on Sheet1(Testing). It allows me to merge certain ranges on that sheet. Here it is:
Private Sub Merge()
Dim Ary As Variant
Dim Rng As Range
Dim a As Variant
Ary = Array("B23:B24", "B25:B26", "B27:B28", "B29:B30", etc etc etc ......)
For...
I have a workbook that I am making copies of and saving those copies as different names.
For some reason, what appears to be random, some of the files don't get the .xlsx extension added to the saved file.
The files are being saved with the correct name convention I setup, but the file...
So thanks to a number of kind people here, I have been guided and helped a number of times. Thank you to those that have done so and been patient with my questions as well as lack of understanding. I am learning and your guidance challenges me to learn me. Thank you!
I have a scenario where I...
There is a bit of code I am using to remove rows where if certain text in the column is not present, the row is deleted, thus leaving only the header and the rows that do contain the required text.
The code is as follows and works quite well:
Sub DeleteRows()Dim r As Long, lr As Long
lr =...
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.