ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection Data from a Range (https://www.excelbanter.com/excel-programming/336653-selection-data-range.html)

Mr M Walker[_2_]

Selection Data from a Range
 
I am trying to select data from a range of data using an If STATEMENTS, is
this possible please see below:

I am trying to return 10 columns of data if a uique number is found in a
spreasheet for example

005
006
007
008

if sheets1.cells(r,1) = "007" then
sheets2.cells(r,1) = sheets1.cells(r,1)
sheets2.cells(r,2) = sheets1.cells(r,2)
sheets2.cells(r,3) = sheets1.cells(r,3)
End if




Tom Ogilvy

Selection Data from a Range
 
possibly try this modification:

if sheets1.cells(r,1).Text = "007" then
sheets2.Cells(r,1).Resize(1,10).Value = _
sheets1.Cells(r,1).Resize(1,10).Value
end if

Note that the Sheets2 and Sheets1 is usually Sheet2 and Sheet1 unless you
changed them in the VBE.

--
Regards,
Tom Ogilvy


"Mr M Walker" wrote in message
...
I am trying to select data from a range of data using an If STATEMENTS, is
this possible please see below:

I am trying to return 10 columns of data if a uique number is found in a
spreasheet for example

005
006
007
008

if sheets1.cells(r,1) = "007" then
sheets2.cells(r,1) = sheets1.cells(r,1)
sheets2.cells(r,2) = sheets1.cells(r,2)
sheets2.cells(r,3) = sheets1.cells(r,3)
End if







All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com