The problem is your "Do While" loop isn't looping through anything!
You said "Range("B3").select
which makes Cell B3 the ACTIVE CELL.
so, even if your whole macro works, it will check to see if B3 is empty, 
copy B3, then it's DONE!

next, you're jumping back and forth... select sheet1, copy the cell, select 
sheet2, paste, select sheet1.........

It's not necessary.

try this:

Sub WriteShe2()
    Sheets("Sheet1").Select
    For Each Data In Sheets("Sheet1").Columns("B").Cells
        If (Data.Value <> "") Then Sheets("Sheet2").Cells(Data.Row, 
Data.Column) = Data.Value
    Next
End Sub


Or.. you could just use:

Sub WriteShe2()
    Sheets("Sheet2").Range("B1:B65000") = 
Sheets("Sheet1").Range("B1:B65000").Value
End Sub


Paul




________________________________
From: "2008ra...@gmail.com" <2008ra...@gmail.com>
To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
Sent: Tuesday, May 12, 2009 8:48:06 AM
Subject: $$Excel-Macros$$ Write a text from a sheet to another sheet


hi group of excel's members

i hope your everything be EXCELlent.

i have two sheets.that sheets name are Sheet1 and Sheet2.
i have texts in column B of sheet1 and i wanna write same texts in
sheet2 .

i was write bellow code but it is not write that texts in sheet2.

Sub WriteShe2()
Sheets("sheet1").Select
  Range("B3").Select
  Do While Not IsEmpty(ActiveCell)
  With ActiveCell
      datett = .Value
      ActiveCell.Offset(1, 0).Select
  Sheets("sheet2").Select
      .Value = datett
      ActiveCell.Offset(1, 0).Select
  End With
  Sheets("sheet1").Select
  Loop
end sub

how can i do it?


--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to