Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default If Then macro with text

Hi,

I need help with code that will search a list for cells with text in A1:A5
in sheet 2 and 3, and any text that exists will be listed in a column in
sheet 1.

what should I do?

thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default If Then macro with text

Something like this maybe...

Sub CopyDataToSheet1()
Dim R As Long
Dim C As Range
Dim SH As Variant
R = 2 'start row in Sheet1
For Each SH In Array(Worksheets("Sheet2"), Worksheets("Sheet3"))
For Each C In SH.Range("A1:A5")
If C.Value < "" Then
Worksheets("Sheet1").Cells(R, "A").Value = C.Value
R = R + 1
End If
Next
Next
End Sub

Rick


"kevin026" wrote in message
...
Hi,

I need help with code that will search a list for cells with text in A1:A5
in sheet 2 and 3, and any text that exists will be listed in a column in
sheet 1.

what should I do?

thanks!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default If Then macro with text

Try this simple macro
Sub getinfofromshts()
For i = 2 To 3
sh = Sheets(i).Name
With Sheets(1)
For Each c In Sheets(sh).Range("a1:a8")
lr = .Cells(Rows.Count, 1).End(xlUp).Row + 1
If Not IsNumeric(c) Then c.Copy .Cells(lr, 1)
Next c
End With
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"kevin026" wrote in message
...
Hi,

I need help with code that will search a list for cells with text in A1:A5
in sheet 2 and 3, and any text that exists will be listed in a column in
sheet 1.

what should I do?

thanks!


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
Macro - Fixed text code needs replacing with variable text steven.holloway Excel Discussion (Misc queries) 3 July 22nd 08 03:57 PM
Macro - Inserting text to a cell already containg text Dileep Chandran Excel Worksheet Functions 5 December 7th 06 03:42 PM
Macro - Inserting text to a cell already containg text Dileep Chandran Excel Discussion (Misc queries) 6 December 7th 06 03:42 PM
Need a macro to insert text in a cell that already has text.Excel go1angel Excel Discussion (Misc queries) 2 October 5th 05 10:32 PM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM


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