lastrow

  1. J

    VBA: Dynamic Chart Range dependent on Last Row

    Hi, I've put together a macro with a range of data where the lastrow has been defined. All is well for the "table" - officially not a table but when I rerun the macro and set the range for the chart it goes to a completely different row The last row should be row7 - above "TOTAL" and it works...
  2. S

    CDate

    Greetings, I have a I column of values of the format " Aug 30, 2018" and so on. I would like to be able to convert these into the format "MM/DD/YYYY" Dim A as Long, LastRow as Long LastRow = Cells(Rows.Count,"A").End(xlUp).Row For K = LastRow to 1 Step -1 CDate(Cells(K,"A").value) =...
  3. J

    XML http: Trying to get outertext!

    URL in E1 is: https://www.tesco.com/groceries/en-GB/shop/fresh-food/all?include-children=true&page=1&count=48 I am trying to get the outertext, which should for example return: Tesco British Salted Block Butter 250G↵Write a review↵↵Sorry, this product is currently unavailable↵↵Rest of ↵Block...
  4. D

    Msgbox with range output

    Hello, I would like to know if anyone is able to help with some msgbox issue. Idea is to have a list of items be displayed in msgbox. I barely use msgbox and i found some info and played a bit and managed to get this code, but not sure how to edit it in a way that the range is from fix start...
  5. T

    VBA code - understanding the lines

    Hi all, I found the following code when searching for a way to insert multiple rows based on a given cell's value. Can someone please help me understand what the code says? Sub Insert_Row () Lastrow = Worksheets(“Sheet1”).Cells(Rows.Count, 1).End(xlUp).Row For i= Lastrow To 2 Step by -1...
  6. J

    Runtime 91 in autofilter.sort.sortfields

    I'm running into an issue with a sort command, that I'm sure I'm missing something simple and just overthinking.... any help appreciated figuring out what went wrong. Using Excel 2016. Public Const EnrollmentCol As String = "AF" Sub ImportSort() Dim CompleteWBFullName As...
  7. A

    VBA to paste value above

    Hey community, I use following formula, to fill blank cells with value above. I wanna know how can i start this code from 5th row and end in 1000 row? in second column? Sub FillBlanksValueAbove()Dim sName As String sName = ActiveSheet.Name Dim ws As Worksheet Dim lastRow As Long, lastCol As...
  8. M

    Copying Multiple workbooks columns into another workbook.

    Hi, Good morning. I am very new to this. I am currently trying to create my first macro with the function of copying specific columns from different workbooks (4 workbooks) to a "master" workbook. The copied column should proceed to the last row on the master file. My code is painful to look at...
  9. C

    VBA sumproduct with dynamic range

    Hi, can some one help me to make SUMPRODUCT formula with dynamic range, as below. Actual formula With Range("c2:c" & LastRow) .Formula = "=SUMPRODUCT(--(MONTH(sales!$B$2:$B$300)=$A2),sales!$K$2:$K$300)" .Value2 = .Value2 End With Required like this With Range("c2:c" &...
  10. S

    copying cells from sheet 1 to various other sheets

    Hi I have a spreadsheet which has over 1000 lines, all for varying companies. What I would like to do is create an option so when you run it, it will copy the relevant lines to their respective sheet. The code listed below is some I have seen on here, which works to a point. It will run for one...
  11. J

    VBA issue: strFormulas returning 1004 error

    Hi, I've applied similar logic to two other macros but for some reason I am unable to figure out what I'm doing wrong :crash: Sub sfortest()Sheets("Cleanup").Select Range("M2").Select Dim Lastrow As Long Lastrow = Range("L" & Rows.Count).End(xlUp).Row Dim strFormulas(1 To...
  12. C

    Add formula after index, match

    Hi friends, is it possible to add formula after index match in vba , in normal index match its working but not with vba. vba code Sub lookup() lastrow = Cells(Rows.Count, "e").End(xlUp).Row For i = 2 To lastrow Range("e" & i) = Range("b" & Application.Match(Cells(i, 4)...
  13. J

    Compare two worksheets

    Hi, I have the code below but not working want to find difference between JAN/JUL tabs both column A but not working I kow there's a difference because one has 316 rows and the other one 315 then there's one line missing in JUL tab has only 315. here is the code: Sub compare() Dim myRng As...
  14. B

    Copying Rows With Highlighted Cells Multiple Columns

    Hello, I have this code that extracts rows with highlighted cells based on which column I point to. Right now it points to column "C". My data range spans from Column C through Column N. Each time I run this code I manually change column reference. Highlighted cells can be found anywhere...
  15. J

    VBA: Append rather than copy over

    Hello I have the following code which copies from one sheet and pastes from Row 8 in the next. Each time I run the macro it copies over, I would like to change it to append the data. Any thoughts, thanks. Sub Add_to () Application.ScreenUpdating = False Dim i As Long Dim Lastrow As Long...
  16. D

    Find result in a worksheet and use to copy information in another

    Hello all, The resource feeding one of my workbooks has changed. The source now puts an entry everytime it is entered in the database. This results in many lines with almost identical information. I nee to adjust the logic at the start to account for this. Here is the code: Sub Workie()...
  17. M

    Why aren't my newly inserted columns being populated with the Formula?

    Hey guys! First the code: Sub MyInsertColumn() Dim wks As Worksheet Dim i As Long Dim Lastrow As Long Application.ScreenUpdating = False Lastrow = Range("A" & Rows.Count).End(xlUp).Row For Each wks In ActiveWindow.SelectedSheets With wks For i =...
  18. DataBlake

    Get the last column of a selection

    I want to store lastCol as a variable equal to the last column in the current selection Sub selectionEDIT() Dim sSelect As Range Dim lastCol As Long Dim lastRow As Long Set sSelect = Selection lastCol = sSelect.SpecialCells(xlCellTypeLastCell).Column lastRow =...
  19. sharky12345

    Find value with criteria then copy row

    I'm using this to find a value in a range subject to criteria; Lastrow = Range("A65536").End(xlUp).RowFor Each cell In Range("A2:A" & Lastrow) Set r = Sheet4.Cells.Find(What:=cell, After:=[B1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious) If Not r Is Nothing Then cell.Offset(0, 1) =...
  20. A

    Cut & Paste VBA

    Hi, I am new to VBA, getting a bit of a hang of it. I found this code via forums etc. Sub Delete_Data() Dim i As Long, lastrow As Long, mydate As Date, erow As Long lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).row Application.ScreenUpdating = False For i = lastrow To 2 Step -1 mydate...

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