Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
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

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
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM


All times are GMT +1. The time now is 07:49 AM.

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"