1. N

    Looking to get Name value offset to set dynamic sheet names

    I have a small table and some code which shouls extract the Generic Category value for each row and then use that Name value to greate new worksheets with. My table: and my code: Sub CommandButton1_Click() Dim cProduct As String Dim myRange As Range Dim sCell As Range Dim copySize As...
  2. G

    VBA Loop through column range and Offset the output

    Hi All, I have the following data in column A of a worksheet starting from cell A1: Column A Column B ====== ============ xxx ABC xxx 123 4567 876 I am looking for VBA code that will colour the cell in column B in yellow if the cell to the left in column A contains "xxx" or...
  3. S

    Type mismatch error

    I am unsurea bout why htis is not working and giving me a type missmatch error Private Sub SubmitCSR_Click() Dim LastRow As Long Dim ws As Worksheet: Set ws = Sheets("GP count") 'declare a variant array Dim ReceivedV(1 To 6) As String 'populate the array ReceivedV(1) =...
  4. C

    Delete all other columns

    I'm trying to write some code that deletes the unspecified columns based on the header and for one reason or another the code does not execute. wbDest.Activate lastColumn = Cells(1, Columns.Count).End(xlToLeft).Column For i = 1 To lastColumn If Cells(1, i).Value <> "Ordered...
  5. W

    Convert .jpg files to PDF

    Hello, I currently have thousands of folders with each of them having up to 10 .jpg image in them. My goal is to create a macro that goes over all folders, and for each of them, converts all .jpg files inside it into one PDF (1 img/page). I have successfully made the macro for one folder, so...
  6. wsnyder

    Evaluate Variable At Run-Time

    Hi, Using Excel 365. How do I evaluate a variable at run-time? The code below is returning sp1, sp2, sp3 I am trying to evaluate the variable as Alpha, Bravo, Charlie, Thanks -w Sub foo2() Const sp1 As String = "Alpha" Const sp2 As String = "Bravo" Const sp3 As String =...
  7. J

    VBA: How can I make my sub-procedure dynamic to loop through a range?

    I have a log that keeps track of what documents my employees have read. When they have read one in person, I manually change the color of the cell in my workbook. Then I have a macro that will look for any cells with the same document name as its value and will match the color. I want to be able...
  8. L

    Check value exists update it or add it

    Hi Everyone, I have issue with VBA with For next loops and verifying data. Right now this macro does 2/3 of what I want, but I cannot get it to add the row on the end if it does not find it. My goal is to check wb2 column "k" values against wb1 column "k" values and update if its their, and...
  9. J

    Macro Help

    Hi all, I need help with an excel macro. I have only started to use macros and as a result have a very basic knowledge and understanding. I was wondering is it possible to create a macro that can be reused even when the raw data coming in changes the position of the cell that the macro was...
  10. B

    Loop not working in VBA post i value 1482

    Sub Case_Automation() Dim a As Long Dim b As String Dim c As Long Dim d As Long Dim e As Long Dim f As Long Dim g As Long Dim h As Long Dim z As Long Dim j As Long Dim k As Long For z = 10 To 50003 a = Cells(z, 8).Value b = Cells(z, 27).Value c = Cells(z, 14).Value d = Cells(z, 18).Value e...
  11. dreen

    Code freezing when running loops

    I have two workbooks, one with the Code INSIDE of it Sheet1 (which is the codename of the sheet I want to copy values from) and another workbook defined as "y" in this example. I want to copy over the values of cell "K1-K10" in Sheet1 into cell ("F1-F10") of workbook y (For example, I want...
  12. E

    VBA to loop through one range to find closest value in another range

    Hello. I know this has to be answered before but I couldn't find anything in the forums. What I am trying to do is this...I have two named ranges, LR and LR2, each on a different sheet. I'm trying to create a If and For loop that would go through range LR and match it with a value in LR2 IF...
  13. D

    Make VBA loop more efficient - needs to handle a lot of data

    Hi Guys, So I have a VBA macro which I can rearrange data with but need some help to make it more efficient. So i have a lot of source data (~900,000 rows), populating A2:AD900,000. My code works down column AM which is populated with names. So the code takes the name from AM2 and loops down...
  14. E

    Permutations of sets of values

    Hello, I'm a new VBA user and really need some help. I'm trying to perform pairwise permutations of an undetermined number of values entered along a single row. The permutations should be exported into columns A and B in another tab. Then I want to repeat this process for the next and all...
  15. L

    Exiting a nested for cycle

    Hello guys, I sometimes have for loops nested in for loops, but once i find my answer id like all of the loops to exit, not just the current one. My current code looks like: For Each item1 In fulllist1 For Each item2 In fullList2 If item2.Text = "hit" Then done = True...
  16. Z

    Subscript out of Range every time?

    I keep getting a "subscript out of range" error on the If statement. I've tried changing the start index to 0 and 1 and it still had this error. Sorry the codes messy, part of the reason I've been messing around with a lot of different ways to declare the array. I'm trying to alter values of...
  17. T

    Writing multiple for loops together

    Hi, I am writing a program in excel VBA where I want to write two for loops together. For example, For x = 1 to 10 and For y = 1 to 10 do something ... Next But if I write "and" between two for statements the program shows error. If I put : between the for statements or write them...
  18. H

    loop with in loops

    Sheet1 of workbook A, containes a column listing file names stored in a specific folder and two columns over the corresponding row contains a number. This number represents the number of times i need to copy and paste the data in the corresponding file onto sheet 2 of workbook A. A...
  19. T

    Range search and return

    This, I thought would be easy... I'm still very much a novice but I've been learning and I can do it with array formulas so I thought, VBA shouldn't be a problem... one whole Saturday later. I have a very large and growing range of data, Sheet("Tally"), the source And another...
  20. P

    For Each Loop and Functions

    I imagine this is painfully simple, yet all my research and trying to figure it out on my own has led to failure. I've learned how to create a button in Excel and create code in VBA to have that button change cell values. The problem is that right now I only know how to affect one cell at a...

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