Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default Macro ?-moving info from 1 sheet to first blank section on another

I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)

For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.

I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Macro ?-moving info from 1 sheet to first blank section on another

Here is some code that will find the first blank cell in a column...

cells(rows.count, "A").end(xlup).offset(1,0).select
What this is doing is it it going to Cell A65,536 and then traveling up to
the first cell with data in it. It then offsets down 1 cell to give you the
first blank cell.
--
HTH...

Jim Thomlinson


"carrera" wrote:

I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)

For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.

I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default Macro ?-moving info from 1 sheet to first blank section on ano

Very cool Jim. I inserted it in the right place, and so far, so gool
However, that uncovered a small glitch in my macro...when I was recording
the macro originally, my intent was to be able to highlight any 4 rows and
run the macro. But, the first line of the macro reads

Rows("14:17").Select

so of course it keeps taking those 4 rows.
How do I rewrite that line so it take whatever 4 rows I highlight, then runs
the macro?

Thanks


"Jim Thomlinson" wrote:

Here is some code that will find the first blank cell in a column...

cells(rows.count, "A").end(xlup).offset(1,0).select
What this is doing is it it going to Cell A65,536 and then traveling up to
the first cell with data in it. It then offsets down 1 cell to give you the
first blank cell.
--
HTH...

Jim Thomlinson


"carrera" wrote:

I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)

For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.

I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Macro ?-moving info from 1 sheet to first blank section on ano

On Mar 12, 2:01*pm, carrera wrote:
Very cool Jim. I inserted it in the right place, and so far, so gool
However, that uncovered a small glitch in my macro...when I was recording
the macro originally, my intent was to be able to highlight any 4 rows and
run the macro. But, the first line of the macro reads

Rows("14:17").Select

so of course it keeps taking those 4 rows.
How do I rewrite that line so it take whatever 4 rows I highlight, then runs
the macro?

Thanks



"Jim Thomlinson" wrote:
Here is some code that will find the first blank cell in a column...


cells(rows.count, "A").end(xlup).offset(1,0).select
What this is doing is it it going to Cell A65,536 and then traveling up to
the first cell with data in it. It then offsets down 1 cell to give you the
first blank cell.
--
HTH...


Jim Thomlinson


"carrera" wrote:


I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)


For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.


I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.


Thanks- Hide quoted text -


- Show quoted text -


Try using ActiveCell.Row to detect which row is selected.
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default Macro ?-moving info from 1 sheet to first blank section on ano

If you are going to manually select the rows, then you can just use Selection
in your macro (they are already selected). Or, Selection.EntireRow.Select
will work whether whole rows or just cells are selected.

Hope this helps,

Hutch

"carrera" wrote:

Very cool Jim. I inserted it in the right place, and so far, so gool
However, that uncovered a small glitch in my macro...when I was recording
the macro originally, my intent was to be able to highlight any 4 rows and
run the macro. But, the first line of the macro reads

Rows("14:17").Select

so of course it keeps taking those 4 rows.
How do I rewrite that line so it take whatever 4 rows I highlight, then runs
the macro?

Thanks


"Jim Thomlinson" wrote:

Here is some code that will find the first blank cell in a column...

cells(rows.count, "A").end(xlup).offset(1,0).select
What this is doing is it it going to Cell A65,536 and then traveling up to
the first cell with data in it. It then offsets down 1 cell to give you the
first blank cell.
--
HTH...

Jim Thomlinson


"carrera" wrote:

I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)

For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.

I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default Macro ?-moving info from 1 sheet to first blank section on ano

Thanks Tom, once the solutions are in front of me, they make perfect sense,
that worked perfectly.

Thanks Terry for your contribution, I'm sure it would work too, but I was
already on this track, and didn't want to recreate the wheel.


"Tom Hutchins" wrote:

If you are going to manually select the rows, then you can just use Selection
in your macro (they are already selected). Or, Selection.EntireRow.Select
will work whether whole rows or just cells are selected.

Hope this helps,

Hutch

"carrera" wrote:

Very cool Jim. I inserted it in the right place, and so far, so gool
However, that uncovered a small glitch in my macro...when I was recording
the macro originally, my intent was to be able to highlight any 4 rows and
run the macro. But, the first line of the macro reads

Rows("14:17").Select

so of course it keeps taking those 4 rows.
How do I rewrite that line so it take whatever 4 rows I highlight, then runs
the macro?

Thanks


"Jim Thomlinson" wrote:

Here is some code that will find the first blank cell in a column...

cells(rows.count, "A").end(xlup).offset(1,0).select
What this is doing is it it going to Cell A65,536 and then traveling up to
the first cell with data in it. It then offsets down 1 cell to give you the
first blank cell.
--
HTH...

Jim Thomlinson


"carrera" wrote:

I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)

For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.

I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.

Thanks

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Macro ?-moving info from 1 sheet to first blank section onanother

On Mar 12, 12:54*pm, carrera
wrote:
I'm creating a spreadsheet with 10 tabs, each one being a different hosptial.
Each section of rows on a sheet will contain various patient information (4
rows per patient)

For when patients transfer from one hospital to another, I'm going to have
hyperlinks so the user can highlight the information on one section of rows,
of let's say Southside Hospital, click on the hyperlink, and have the
information cut from that section (deleting those rows) and pasting into the
next available section in the receiving hosptial, let's say Northside
Hospital.

I'm recording other macros on each sheet for other purposes, but I don't
know how to get it that the information won't be pasted over existing
information on another patient.

Thanks


Alternitvely you could use something like
ActiveSheet.UsedRange.Rows.Count and add one to it to get the next
unused row.

For Instance, say you have some data found in Cells A1:C4 on Sheet1
that when you click this hyperlink you want it to remove the rows from
Sheet1 and move it to the first unused portion of Sheet2 to you could
use the following code:

Sheets("Sheet2").Range(Sheets("Sheet2").Cells(Shee ts("Sheet2").UsedRange.Rows.Count
+1,1),Sheets("Sheet2").Cells(Sheets("Sheet2").Used Range.Rows.Count
+5,1)).Value = Sheets("Sheet1").Range("A1:C4").Value ' Copy data to
other sheet

Sheets("Sheet1").Range("A1:C4").Delete Shift:=xlUp ' Delete old data

Although this may look long it has several advantages:
Setting range values equal to eachother is faster than using the copy
and paste method
Using the Sheets("Sheetx"). allows you to not have to change sheets to
run the macro, also making it run faster and removing screen flicker
associated with most macros.

-Terry
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
Moving Info from onw sheet to another Mike Excel Worksheet Functions 23 January 10th 08 09:27 PM
to Anne and others who do not put info in the message section bj Excel Discussion (Misc queries) 4 August 9th 07 07:36 PM
How do i get sheet 2 to show a specific section of sheet 1?Please Kev Excel Worksheet Functions 4 May 1st 07 05:48 PM
Based on Drop-Down Selection go to that Section on Sheet Golova Excel Discussion (Misc queries) 3 April 17th 07 07:26 PM
Formula for moving a row into another section of the Worksheet Scottm New Users to Excel 2 March 14th 07 04:53 PM


All times are GMT +1. The time now is 12:38 PM.

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"