WebMar 18, 2024 · Provided you are attempting to select your entire range of data (i.e. A1 to your last row and column), you can use the following method: Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets (1) ws.UsedRange.Select. That should select all of your data. This is also assuming you're working with the first worksheet. Share. WebJul 11, 2024 · 1 Answer. To copy the whole column A from the sheet "CopyFromThisOne" to a new, empty workbook: Sub CopyWholeColumnA () Dim wb as Workbook Set wb = Workbooks.Add With ThisWorkbook.Worksheets ("CopyFromThisOne") .Range ("A:A").Copy wb.Worksheets (1).Range ("A1") End with End Sub. To copy row 1 to the …
vba - Return a range from A1 to the true last used cell - Stack Overflow
WebApr 19, 2024 · To find last row, you should use specific column number (for column that you want to know last row). You have two options there: xlDown - you can think of it like this: … WebSep 16, 2008 · Function GetLastRow (strSheet, strColumn) As Long Dim MyRange As Range Set MyRange = Worksheets (strSheet).Range (strColumn & "1") GetLastRow = Cells (Rows.Count, MyRange.Column).End (xlUp).Row End Function. Regarding a comment, this will return the row number of the last cell even when only a single cell in the last … sims 4 apk free file
Re: Help with vba formula to autopoulate - Microsoft …
WebFor instance I want to select Range(A2:L2) to the last row of data in the spreadsheet. I have tried, Dim Lastrow As Integer Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row Range("A2:L2" & Lastrow).Select But this selects from A2:L2 all the way down to the bottom of the spreadsheet. I have checked to see if Lastrow was incorrect … WebDec 7, 2024 · Count rows in excel vba. Select the worksheet in which you. Count Rows With Data Using Excel Vba In A Whole Sheet. Declare variable first_row as long, rows. … WebFeb 27, 2015 · This is what I use to get the last row; just give it a column and a sheet. Function getLastRow(sheet As String, Col As Variant) As Integer getLastRow = Sheets(sheet).Cells(Sheets(sheet).Rows.Count, Col).End(xlUp).row End Function Then you can use it like this: Range("A" & getLastRow(ActiveSheet,"A")).Select 'Select the last … rbc reward points value to cash