LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 1st attempt vba-how do i whatnext in this sub

hi all
My 1st attempt at vba and i am stuck
I have approx 60000 rows to process
As you can see program find the word material and then copies and paste
various cell onto sheet two, when it reads the cell content to be 9998 it
jump out of the loop.This work brillantly but I need it to now look for the
second occurance of the word material and process that position. then fourth
occurances ect untill all occurance of the word material has been
done.thanks in advance for any help

Sub Find_First()


Dim FindString As String
Dim Rng As Range
Sheets("Sheet1").Select
FindString = ("MATERIAL")
If Trim(FindString) < "" Then
Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then Application.Goto Rng, True
End If
Application.ScreenUpdating = False
'Sheets("Sheet1").Select
'Range("b8").Select
ActiveCell.Activate
ActiveCell.Offset(rowOffset:=0, columnOffset:=2).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("f" & finalrow + 1).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=2, columnOffset:=0).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("g" & finalrow + 1).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=8).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("h" & finalrow + 1).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=5, columnOffset:=-6).Activate
Do Until n = 80
If Selection.Value = ("9998") Then n = 80
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("A" & finalrow + 1).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=5).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("B" & finalrow + 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=3, columnOffset:=0).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("C" & finalrow + 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("D" & finalrow + 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=-4, columnOffset:=2).Activate
Selection.Copy
Sheets("Sheet2").Select
finalrow = Range("a65536").End(xlUp).Row
Range("E" & finalrow + 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
ActiveCell.Offset(rowOffset:=5, columnOffset:=-7).Activate
ActiveCell.Select
Loop
Application.ScreenUpdating = True
Sheets("Sheet2").Select

End Sub


 
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
Passed Exam in first attempt Raj[_4_] New Users to Excel 1 June 5th 09 04:13 PM
Sumproduct - Second Attempt Sandy Excel Worksheet Functions 4 August 10th 07 06:02 PM
'of' percentage with calculation (attempt 2) Steve Crowther Excel Discussion (Misc queries) 4 May 22nd 06 12:58 PM
First attempt at VBA coding problem Rick in NS New Users to Excel 9 January 12th 06 05:11 PM
2nd attempt at excel VB commands joel Excel Programming 9 May 10th 04 08:31 AM


All times are GMT +1. The time now is 11:00 PM.

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

About Us

"It's about Microsoft Excel"