#vba

  1. Z

    VBA calculates numbers incorrectly (basic arithmetic)

    I have this VBA code that converts the quantity of an item from how many inches to how many rolls this code is not working on a particular file, see below, there are 276 inches of this item using this equation: ((n / 12) \ 14.5) * 2, and the returned result is 0 ? Test file below...
  2. Z

    VBA not copying cell value when running it on certain files

    I have this code that counts the number of "CHAIN & EYEBOLT" in some excel files, then adds one row at the end of the file to show the total number of this item. The new row should always have: column A (value from cell above), C (total number of the item), B, D, I and K with the static values...
  3. Z

    Code is executed even when certain criterias are not met

    I have this code that adds 5 new rows after any row that contains Solmax or AGRU in column 11, also contain Liner in column 11, and contain Sanitary in column 15 the code is working fine when these criterias are met...the problem is it adds these 5 rows even when column 15 does not contain...
  4. Z

    Modify a cell value if two other cells contain certain value

    I need to modify some excel files, if column K contains "AO", "COVER", and column N contains "Tampa" then any "Riser", "Cone", 'Top slab" (column K) with the same item label (column B) gets the letter J at the end of the value in column D so in the screenshot below, rows 2 and 3 will be: F14632J...
  5. A

    Populating a New Static Date When a Drop Down List is Changed

    Hello, I am trying to track some testing specimens at work, and I would like to have to automatically populate a date when the status drop down menu is changed. For example, I have a status column located in column G. The status has a drop down menu including Not Received, Specimens Received...
  6. Z

    add a blank row after certain cells

    I need to add a blank row before when value in B changes, in the example file below, a blank row will need to be added after the highlighted cells. How do I approach this issue with VBA? Note: the value in column B can be any length, sometimes it is just a number, sometimes it is a combination...
  7. Z

    If a cell contains certain keyword, then move values from 1 cell to another (same row)

    I need to modify a bunch of excel files, for any row that contains the word "Skimmer", I need to move the value from column B (same row) to in front of Skimmer (always in column K) like this: (1)Skimmer, (2)Skimmer, (3)Skimmer. (The value in column B does not need to be removed) see below for...
  8. S

    VBA code for Excel tables into ppt - automation

    Hi all, I have an excel file used to generate ~15 tables of data. This report needs to be generated every week and I wanted to automate the 'from excel to ppt' updaiton. I am using the below code. it works for the active sheet, but how can I make the macro to go to the next sheet, copy paste a...
  9. J

    How do I reference range of columns for my copy/paste VBA code?

    Hi All, I've been busy creating a code that, depending on whether the values in a column are greater/less than 0, the code will copy those values to the bottom of the table and paste them into a corresponding table. The problem Im having is that Ive had to repeat this code for each column and...
  10. Z

    Always roundup the result of an equation instead of rounddown

    part of my macro has a simple equation n /6, when n is < 6, the result is rounded down to 0. is there any way I can have this result always roundup? .Rows(lrNewRows) = Array(Cells(lr, "A"), ".", n \ 6, "F51114", "No", " ", " ", " ", "Purchased", " ", "Primer") Sub WrapidSealNine() Dim...
  11. Z

    CountIf always counted 1 extra (VBA)

    I have this code to count the number of letter "R" in any given row, see test file below, these two rows contain 2x "R" but my code is spitting out 3 every time... why is that? code below: Dim ws1 As Worksheet Dim lrNew As Long, n As Long, n1 As Long, n2 As Long, sr As Long Set ws1...
  12. Z

    having issue using the function LEN

    I need to count the number of letter "B" in a cell when "CS55" and "B" are present the way I am counting the letter is: length of the string - length of the string without any letter B = the number of letter B code below, error message pops up every time I run it "Type mismatch" Dim lrNew As...
  13. Z

    Method or Data member not found

    in this macro, I am using the CountIf feature to count the # of letter "B" in column K when "CS55" is in column K ws1 is defined, why the error message ""method or data member not found" ? n = ws1.CountIf(Range(lrNew, "K"), "*B*") full code below Sub PaintCS55() Dim ws1 As Worksheet, lrNew...
  14. Z

    Add one more variable to an equation VBA

    part of my macro has this equation: it counts the number of Base, Riser, Cone, TS ( these are in column K), if column O contains Sanitary. What if I want to add one more variable where this equation counts These items ONLY when there is also the number 4 present in column K ? any help is...
  15. Z

    How to use COUNTIF

    I need to calculate the amount of CS55 in a bunch of excel files. When column K contains CS55 and Black, we use this equation or if column K contains CS55 and two letter "B" use: n = n1 * 0.000666 * 7.48 * 2 when column K contains CS55 and one letter "B", use: n = n1 * 0.000666 * 7.48 full code...
  16. Z

    Calculate gallonage using VBA

    I have this macro to calculate the gallonage of paint (CS55), it adds an additional row to the end of the excel file to display the gallonage This part of the macro does the calculation. the "2" in the equation means two layers. .FormulaR1C1 = "=SUMIF(R2C11:R" & lr & "C11,""*CS55...
  17. Z

    Add test to end of cell If a value is present in another cell

    When column M contains "GALV" (any row in a file), I need to add "GALV" to the end of the value in column K (same row) why isnt my code below working? any help is appreciated. Test excel file also attached Sub Galvanized() Dim lr4 As Long Set rng2 = Range("A1").CurrentRegion lr4 =...
  18. Z

    If a cell contain a string then do THIS otherwise do THAT

    part of my macro is to do a tabulation of a certain item when column K contains keywords "9"" and Wrapid-Seal", counts the total qty if K does not contain the keywords then qty = 0 every time I run this macro, qty is always zero, even know the excel file indeed have this item in K. Why is that...
  19. Z

    Add multiple new rows with different data

    I need add 3 rows to the end of an excel file, and fill columns A-D with certain values I know the code below can add one row and fill them with values lr = Cells(Rows.Count, 1).End(xlUp).Row Public lr As Long, lr2 As Long lr2 = lr + 1 Cells(lr2, "A") = "One" Cells(lr2, "B") = "Two"...
  20. Z

    add up certain items then multiply by a constant value and display the result on another row

    I need my macro to calculate the quantity of item "evergrip", the calculation goes like the following: It calculates the total number of "Base", "Riser", "Cone", "Top slab" with the keyword "Sanitary" in column O. the qty of these items are always in column C, the description of these items are...

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