Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default Display Value from Sheet1-A1:A10 to Sheet2-B1

Is is possible to display a value from a range in sheet1 in a cell in Sheet2?

For eg:
In Sheet1, I can get a value in any cell between A1:A10 randomly, the value
is a mix of Numbers and alphabers, such as A1i, C3e, D9f etc
And I want to display this value in Sheet2 Cell B1

How can this be done?

Thanks in Advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default Display Value from Sheet1-A1:A10 to Sheet2-B1

So basically, Scan Sheet1-A1:A10 and locate a cell that has any value
displayed(Only one cell will display a value), then display that value in
Sheet2-B1

How can this be done?

Thanks in Advance.


"sam" wrote:

Is is possible to display a value from a range in sheet1 in a cell in Sheet2?

For eg:
In Sheet1, I can get a value in any cell between A1:A10 randomly, the value
is a mix of Numbers and alphabers, such as A1i, C3e, D9f etc
And I want to display this value in Sheet2 Cell B1

How can this be done?

Thanks in Advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Display Value from Sheet1-A1:A10 to Sheet2-B1

On Aug 28, 1:30*am, sam wrote:
So basically, Scan Sheet1-A1:A10 and locate a cell that has any value
displayed(Only one cell will display a value), then display that value in
Sheet2-B1

How can this be done?

Thanks in Advance.



"sam" wrote:
Is is possible to display a value from a range in sheet1 in a cell in Sheet2?


For eg:
In Sheet1, I can get a value in any cell between A1:A10 randomly, the value
is a mix of Numbers and alphabers, such as A1i, C3e, D9f etc
And I want to display this value in Sheet2 Cell B1


How can this be done?


Thanks in Advance.- Hide quoted text -


- Show quoted text -


Hi,

This can be done using this code -

Option Explicit
Sub findtext()

Dim k As Integer
With Worksheets(1)
For k = 1 To 10 'for the first 10 columns
If .Cells(1, k).Value < "" Then
Worksheets(2).Cells(2, 1).Value = .Cells(1, k).Value
MsgBox "Value copied"
Exit For
Else
'Go to next column
End If
Next k
End With

If k = 11 Then
MsgBox "Didnt find any value"
End If

End Sub

You can extend this to any range you want. If you want the code to
check in the next row (i.e., A2 to A10), then you need to add another
For loop.

HTH,
Regards,
Satish
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Display Value from Sheet1-A1:A10 to Sheet2-B1

Sub findtext()

Dim k As Integer
With Worksheets(1)
For k = 1 To 10 'for the first 10 columns
If .Cells(1, k).Value < "" Then
Worksheets(2).Cells(2, 1).Value = .Cells(1, k).Value
MsgBox "Value copied"
Exit For
Else
'Go to next column
End If
Next k
End With

If k = 11 Then
MsgBox "Didnt find any value"
End If

End Sub


If that is actually what the OP wants, then you can do it without looping...

Sub findtext()
Worksheets(1).Range("A2").Resize(, 10).Copy Worksheets(2).Range("A1")
End Sub

You can extend this to any range you want. If you want the code
to check in the next row (i.e., A2 to A10), then you need to add
another For loop.


If the user wants to do more than one row, that too can be done without any
looping...

Sub findtext()
Worksheets(1).Range("A2").Resize(9, 10).Copy Worksheets(2).Range("A1")
End Sub

--
Rick (MVP - Excel)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Display Value from Sheet1-A1:A10 to Sheet2-B1

On Aug 28, 9:58*am, "Rick Rothstein"
wrote:
Sub findtext()


Dim k As Integer
* * With Worksheets(1)
* * * * For k = 1 To 10 *'for the first 10 columns
* * * * * * If .Cells(1, k).Value < "" Then
* * * * * * * *Worksheets(2).Cells(2, 1).Value = .Cells(1, k).Value
* * * * * * * * MsgBox "Value copied"
* * * * * * * * Exit For
* * * * * * Else
* * * * * * * * 'Go to next column
* * * * * * End If
* * * * Next k
* * End With


* * If k = 11 Then
* * * * MsgBox "Didnt find any value"
* * End If


End Sub


If that is actually what the OP wants, then you can do it without looping....

Sub findtext()
* Worksheets(1).Range("A2").Resize(, 10).Copy Worksheets(2).Range("A1")
End Sub

You can extend this to any range you want. If you want the code
to check in the next row (i.e., A2 to A10), then you need to add
another For loop.


If the user wants to do more than one row, that too can be done without any
looping...

Sub findtext()
* Worksheets(1).Range("A2").Resize(9, 10).Copy Worksheets(2).Range("A1")
End Sub

--
Rick (MVP - Excel)- Hide quoted text -

- Show quoted text -


Absolutely Rick!

I've a habit of using loops (And I know its not that good). I hope to
learn from posts like yours.

regards,
Satish


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Display Value from Sheet1-A1:A10 to Sheet2-B1

Why not just use the following in Sheet2-B1?

=CONCATENATE(Sheet1!A1,Sheet1!A2,Sheet1!A3,Sheet1! A4,Sheet1!A5,Sheet1!A6,Sheet1!A7,Sheet1!A8,Sheet1! A9,Sheet1!A10)


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
Display Sheet1: (A1:A10) value in Sheet2: (B1) sam Excel Programming 11 August 28th 09 06:21 PM
display a value from Sheet1-A1:A10 in Sheet2-B1 sam Excel Worksheet Functions 2 August 27th 09 10:34 PM
A1 Sheet2 is linked to A1 sheet1 so that user enters value(abc123) a1 sheet1 and A1 sheet2 is updated pano[_3_] Excel Programming 2 October 28th 07 02:32 PM
Display Rows From Sheet1 In Sheet2 (Import) Mythran Excel Worksheet Functions 1 March 24th 06 07:40 PM
Combine 3 Columns on Sheet2 to Display in 1 Column on Sheet1 Summer Excel Worksheet Functions 12 June 14th 05 02:56 PM


All times are GMT +1. The time now is 04:10 AM.

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"