I am using VB.net code to manipulate Excel documents. I'm trying to grab a range of cells contained in a single specific row. I don't know the specific end cell, I just need All the cells that contain values in that row.
Here is a basic example of what i've been doing up to this point:
Dim rngRange as Excel.Range
Dim wksXLWorksheet As Excel.Worksheet
rngRange = wksXLWorksheet.Range("A1").EntireRow
I know that row containing the Range "A1" (which is a single cell) is the row that I want, and so I use the EntireRow property to return the entire row. It returns all the cells, including the unused ones, so over 16k in cells, most of them empty.
How can choose a range with only the used the Cells? I don't want to use UsedRange because that grabs everything, I only want the one row, and only up to where the cells no longer contain data.
Also, if i select a limited range like this, will it have more or less impact on resources? I was assuming it would have less impact selecting the small range, but I could be wrong.