ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel as database (https://www.excelbanter.com/excel-programming/279401-excel-database.html)

alanq

excel as database
 
Hi guys,
I am a newbie to VBA.
I am trying to use excel as a database.
I want to search for some value in the database, copy the whole row
and paste on another worksheet for viewing.
The qn is how do i select a range from a cell so i can do a find for
the value and then copy the row in which the cell is, and then paste
on another worksht?

pls advise
thanks
alan

Tom Ogilvy

excel as database
 
to reference the database

set rng = Range("A1").CurrentRegion

a specific column in that rng

Dim rng as Range
Dim rng1 as Range
Dim sStr as String
set rng1 = nothing
set rng = Range("A1").CurrentRegion.Columns(3).Cells
sStr = "ABCD"
set rng1 = rng.Find(What:=sStr)
if not rng1 is nothing then
rng1.EntireRow.copy Destination:= _
Worksheets("Sheet3").Cells(rows.count,1).End(xlup) (2)
End if

See help on the find method for additional arguments and/or turn on the
macro recorder while you do a find manually.



--
Regards,
Tom Ogilvy


"alanq" wrote in message
om...
Hi guys,
I am a newbie to VBA.
I am trying to use excel as a database.
I want to search for some value in the database, copy the whole row
and paste on another worksheet for viewing.
The qn is how do i select a range from a cell so i can do a find for
the value and then copy the row in which the cell is, and then paste
on another worksht?

pls advise
thanks
alan





All times are GMT +1. The time now is 05:14 PM.

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