Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
vb code question Stan Excel Discussion (Misc queries) 1 April 25th 08 09:45 PM
VB Code Question Stan Excel Programming 2 May 2nd 07 08:52 PM
VBA code question?! Mike Excel Programming 1 February 22nd 06 04:38 PM
Code Question Mikk Excel Programming 1 January 23rd 04 12:21 AM


All times are GMT +1. The time now is 09:06 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"