Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transpose and separating worksheet based on Input box name


Hi, this are my codes. It allows me to return a multiple row of the
selected "Region" i entered in the InputBox eg, Europe in another
worksheet named Region.

However i would like them to be separated in different worksheet. for
eg, when the user type in the region -Europe in the input box, a new
worksheet Europe will be created with the information taken from the
rows of all Europe information in raw. I would also like it to be
transpose. Is it possible? Thanks!


Sub getRegion()
Dim fnd As String
Dim fndRng As Range
Dim eRow As Long
Dim ff As String

fnd = InputBox("Enter a Region")

If fnd < "" Then
With Sheets("raw").Cells
Set fndRng = .Find(fnd)

If Not fndRng Is Nothing Then
ff = fndRng.Address
Do
eRow = Sheets("Region").Cells(Rows.Count, 1). _
End(xlUp).Row + 1
fndRng.EntireRow.Copy Sheets("Region").Cells(eRow,
1)
Set fndRng = .FindNext(fndRng)
Loop Until ff = fndRng.Address
End If
End With
End If

End Sub


--
ryll
------------------------------------------------------------------------
ryll's Profile: http://www.excelforum.com/member.php...o&userid=28605
View this thread: http://www.excelforum.com/showthread...hreadid=483057

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Transpose and separating worksheet based on Input box name

Assuming the code you posted copies what you want, then these additions
should get you started

Sub getRegion()
Dim fnd As String
Dim fndRng As Range
Dim eRow As Long
Dim ff As String
Dim sh as Worksheet
fnd = InputBox("Enter a Region")

If fnd < "" Then
set sh = worksheets.Add(after:=worksheets(worksheets.count) )
sh.Name = fnd & "_Data"
col = 1
With Sheets("raw").Cells
Set fndRng = .Find(fnd)

If Not fndRng Is Nothing Then
ff = fndRng.Address
Do
eRow = Sheets("Region").Cells(Rows.Count, 1). _
End(xlUp).Row + 1
fndRng.EntireRow.Copy
sh.cells(1,col).PasteSpecial Transpose:=True
col = col + 1
Set fndRng = .FindNext(fndRng)
Loop Until ff = fndRng.Address
End If
End With
End If

End Sub

--
Regards,
Tom Ogilvy


"ryll" wrote in message
...

Hi, this are my codes. It allows me to return a multiple row of the
selected "Region" i entered in the InputBox eg, Europe in another
worksheet named Region.

However i would like them to be separated in different worksheet. for
eg, when the user type in the region -Europe in the input box, a new
worksheet Europe will be created with the information taken from the
rows of all Europe information in raw. I would also like it to be
transpose. Is it possible? Thanks!


Sub getRegion()
Dim fnd As String
Dim fndRng As Range
Dim eRow As Long
Dim ff As String

fnd = InputBox("Enter a Region")

If fnd < "" Then
With Sheets("raw").Cells
Set fndRng = .Find(fnd)

If Not fndRng Is Nothing Then
ff = fndRng.Address
Do
eRow = Sheets("Region").Cells(Rows.Count, 1). _
End(xlUp).Row + 1
fndRng.EntireRow.Copy Sheets("Region").Cells(eRow,
1)
Set fndRng = .FindNext(fndRng)
Loop Until ff = fndRng.Address
End If
End With
End If

End Sub


--
ryll
------------------------------------------------------------------------
ryll's Profile:

http://www.excelforum.com/member.php...o&userid=28605
View this thread: http://www.excelforum.com/showthread...hreadid=483057



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
How to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
Extracting Data from another worksheet based on user input Alvyn Excel Worksheet Functions 14 August 6th 08 05:41 PM
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 05:23 AM
Separating a List onto multiple worksheets in the same workbook based off 1 criteria DMRbaxter Excel Worksheet Functions 6 April 19th 07 01:36 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 11:16 PM.

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"