View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
logic-phyber logic-phyber is offline
external usenet poster
 
Posts: 1
Default did i do this right (macro)


Where am I going wronge here? I have a workbook where I want to fill in
empty spots on sheet 2 with data on sheet1. if you could let me know or
give me the code that works I usually do this all myself Its just in a
new area of coding and im on a time schedule.

Code:
--------------------

Sub Update()

' Declare Variables
Dim pColA As String
Dim colARange As String
Dim uContinue As Boolean
Dim uRow As Integer
Dim finColA As String
Dim finRow As Integer

' Initialize Variables
uRow = 1
uContinue = True
' Loop through all rows in column 'A' until blank reached
While uContinue = True
Sheets("sheet2").Select
uRow = uRow + 1
colARange = "A" & CStr(uRow)
If Len(Range(colARange).Value) = 0 Then
uContinue = False
End If
For Each Item In Cells(uRow, 1)
pColA = ActiveCell.Value
' Copy From Column I in "sheet1"
Range("B" & uRow).Select
Selection.Copy
' Paste into Column C in "sheet2"
Sheets("sheet1").Select
Set finColA = Cells.Find(pColA, LookIn:=xlValues)
finRow = finColA.Row
Range("A" & finRow).Select
ActiveSheet.Paste
Next
Wend
MsgBox ("Update Complete.")
End Sub

--------------------


Thanks logic


--
logic-phyber
------------------------------------------------------------------------
logic-phyber's Profile: http://www.excelforum.com/member.php...o&userid=37516
View this thread: http://www.excelforum.com/showthread...hreadid=571638