March 22nd, 2013, 10:06 AM
How to select multiple cells of same value in VB?
Does anyone know how I can select multiple cells (for excel) with same values in vb?
>I need to first select cells with same value in a column, >then select the entire row and copy paste it to a new location.
I am new to VB so any help will be greatly appreciated!
March 29th, 2013, 06:34 PM
avoid using copy / paste
Copy/paste are basically excel functions, there is almost always an easier way in VBA
e.g suppose you want all of the rows from "Sheet1" that have the value 7 in column A put into "Sheet2"
sheet1row = 1
sheet2row = 1
for sheet1row = 1 to 1000
if cells(sheet1row,1) = 7 then
for nowcol = 1 to 26
.cells(sheet2row,nowcol) = cells(sheet1row,nowcol)
sheet2row = sheet2row+1