#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default vb code question

I have numeric data in column A which which I want to find and then copy each
row that contains this data in columns A-C. In other words if rows 6 through
21 contain the value 7760 then through VB code I want to copy the data in
rows 6-21 and columns A-C.
I took a stab at the code below but it's giving me a data mismatch error on
the first part.

I'm new to coding so any help you can provide would be greatly appreciated.
Many thanks!



Sub GetData()
Dim rng As Range
Set rng = Range("A:C").Find(What:=7760, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
ActiveCell.Select
ActiveCell.Offset(0, 3).Select

Dim LastCellInN As Range
With ActiveSheet
Set LastCellInN = .Cells(.Rows.Count, "N").End(xlUp)
.Range("A3").Formula = "=N3/" & LastCellInN.Address(0, 0)

End With
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
question on VB code peyman Excel Discussion (Misc queries) 6 October 22nd 07 11:47 PM
Another code question M&M[_2_] Excel Discussion (Misc queries) 3 August 9th 07 10:00 PM
VB Code Question Stan Excel Discussion (Misc queries) 2 May 2nd 07 10:13 PM
VB Code Question Stan Excel Discussion (Misc queries) 6 April 30th 07 11:27 PM
VBA code question JEV Excel Discussion (Misc queries) 2 March 1st 07 06:02 PM


All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"