Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro - How do i....?

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro - How do i....?

I start check column F at Row 1. this may need to be changed.

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
For F_RowCount = 1 To LastRow_F
If Range("F" & F_RowCount) < "" Then
Range("C" & Row_C_Count) = Range("F" & F_RowCount)
Row_C_Count = Row_C_Count + 1
End If
Next F_RowCount

"Malissa" wrote:

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro - How do i....?

Joel,

I tried it and it worked on that worksheet... one more question, what do I
need to do to delete the info from column F after it is moved to column C?

Thanks,
--
Malissa


"Joel" wrote:

I start check column F at Row 1. this may need to be changed.

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
For F_RowCount = 1 To LastRow_F
If Range("F" & F_RowCount) < "" Then
Range("C" & Row_C_Count) = Range("F" & F_RowCount)
Row_C_Count = Row_C_Count + 1
End If
Next F_RowCount

"Malissa" wrote:

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro - How do i....?

Here is a simply methods which I added the delete for column f

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
Range("F1:F" & LastRow_F).Copy
Range("C" & Row_C_Count).PasteSpecial _
SkipBlanks:=True
columns("F").delete

"Malissa" wrote:

Joel,

I tried it and it worked on that worksheet... one more question, what do I
need to do to delete the info from column F after it is moved to column C?

Thanks,
--
Malissa


"Joel" wrote:

I start check column F at Row 1. this may need to be changed.

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
For F_RowCount = 1 To LastRow_F
If Range("F" & F_RowCount) < "" Then
Range("C" & Row_C_Count) = Range("F" & F_RowCount)
Row_C_Count = Row_C_Count + 1
End If
Next F_RowCount

"Malissa" wrote:

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro - How do i....?

Joel,

I recorded my keystrokes to create the first part and this is what it looks
like:

Selection.EntireColumn.Insert
Range("D1").Select
Selection.Copy
ActiveCell.SpecialCells(xlLastCell).Select
Range("A14").Select
Range(Selection, Cells(1)).Select
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
Selection.EntireRow.Delete

Is there a better way? Thanks so much for your help!

--
Malissa


"Joel" wrote:

Here is a simply methods which I added the delete for column f

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
Range("F1:F" & LastRow_F).Copy
Range("C" & Row_C_Count).PasteSpecial _
SkipBlanks:=True
columns("F").delete

"Malissa" wrote:

Joel,

I tried it and it worked on that worksheet... one more question, what do I
need to do to delete the info from column F after it is moved to column C?

Thanks,
--
Malissa


"Joel" wrote:

I start check column F at Row 1. this may need to be changed.

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
For F_RowCount = 1 To LastRow_F
If Range("F" & F_RowCount) < "" Then
Range("C" & Row_C_Count) = Range("F" & F_RowCount)
Row_C_Count = Row_C_Count + 1
End If
Next F_RowCount

"Malissa" wrote:

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro - How do i....?

I just discovered that the first part doesnt always work.. depending on the
size of the worksheet. I am seeing that my keystrokes did reference specific
cells. The part you did adding the delete F is now allowing a blank field
when pasting into column C.
--
Malissa


"Joel" wrote:

Here is a simply methods which I added the delete for column f

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
Range("F1:F" & LastRow_F).Copy
Range("C" & Row_C_Count).PasteSpecial _
SkipBlanks:=True
columns("F").delete

"Malissa" wrote:

Joel,

I tried it and it worked on that worksheet... one more question, what do I
need to do to delete the info from column F after it is moved to column C?

Thanks,
--
Malissa


"Joel" wrote:

I start check column F at Row 1. this may need to be changed.

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
For F_RowCount = 1 To LastRow_F
If Range("F" & F_RowCount) < "" Then
Range("C" & Row_C_Count) = Range("F" & F_RowCount)
Row_C_Count = Row_C_Count + 1
End If
Next F_RowCount

"Malissa" wrote:

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro - How do i....?

3 things

1) Once column F is deleted you can't rerun the code a 2nd time. When using
macros, copy the original sheet to a temporary sheet to save your original
data. Then copy back to temporary sheet to the original shee as you develope
your macro. I usually just hightlight the gray cell between Row 1 and Column
A to hight the entrie worksheet. Then go to a tempory worksheet and press
the same gray key and paste. then copy the temp sheet back to the original
as I'm developiong the macro

2) Not sure why column F is blank. Is it because it was deleted did the
column change when you inserted a new column.

3) I modified you recorded code. I don't think it is exactly what you want.
I didn't know which column to Insert so there is a question mark below.
Change to the correct column. I also think you wanted the Last Row in Column
A, not A14 so I made a simple change. The code was deleteing column A after
you put data into column A. Doesn't make sense.

'insert column Not sure which column Because
'you code started with a column already selected
Columns("?").Insert
'get LastRow in Column A
LastRow_A = Range("A" & Rows.Count).End(xlUp).Row
'Copy D1 to column A, rows 1 to Last Row
Range("D1").Copy _
Destination:=Range("A1:A" & LastRow)
'Do you really want to delete column A
Columns("A").Delete

If you have more problems post all the code so I can see how you are
progressing.
"Malissa" wrote:

I just discovered that the first part doesnt always work.. depending on the
size of the worksheet. I am seeing that my keystrokes did reference specific
cells. The part you did adding the delete F is now allowing a blank field
when pasting into column C.
--
Malissa


"Joel" wrote:

Here is a simply methods which I added the delete for column f

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
Range("F1:F" & LastRow_F).Copy
Range("C" & Row_C_Count).PasteSpecial _
SkipBlanks:=True
columns("F").delete

"Malissa" wrote:

Joel,

I tried it and it worked on that worksheet... one more question, what do I
need to do to delete the info from column F after it is moved to column C?

Thanks,
--
Malissa


"Joel" wrote:

I start check column F at Row 1. this may need to be changed.

LastRow_C = Range("C" & Rows.Count).End(xlUp).Row
Row_C_Count = LastRow_C + 1
LastRow_F = Range("F" & Rows.Count).End(xlUp).Row
For F_RowCount = 1 To LastRow_F
If Range("F" & F_RowCount) < "" Then
Range("C" & Row_C_Count) = Range("F" & F_RowCount)
Row_C_Count = Row_C_Count + 1
End If
Next F_RowCount

"Malissa" wrote:

I have a worksheet that starts out like this with 5 columns:

A B C D
E
1000 0 14630.17 Bank of Amer Disbursement Account
2200 0 250.64 401K Pension Due
6220 5192.31 0 Staff Veterinary Salaries 0
6223 1179.74 0 Veterinary Assistant Wages 157.81
6224 908.5 0 Receptionist Wages 79
6225 4843.19 0 Veterinary Technician Wages 410.98
6227 1346.15 0 Practice Manager Wages 0
6245 262 0 Grooming Payroll Expenses 0
6290 1380 0 Payroll Taxes
6290 0 3525.19 Payroll Taxes-ee
6290 3525.19 0 Payroll Taxes-ee
6315 0 14.4 Disability Insurance
6330 0 342 Medical/Dental Insurance
6355 125.32 0 Retirement Plan Contributions

The first part of the marco I have created creates a new column before A and
takes the amount in row 1column C and pastes it to all rows that hold
information then deletes first row.
Looks like this:

A B C D E
F
14630.17 2200 0 250.64 401K Pension Due
14630.17 6220 5192.31 0 Staff Veterinary Salaries 0
14630.17 6223 1179.74 0 Veterinary Asst Wage 157.81
14630.17 6224 908.5 0 Receptionist Wages 79
14630.17 6225 4843.19 0 Veterinary TechWages 410.98
14630.17 6227 1346.15 0 Practice Manager Wages 0
14630.17 6245 262 0 Grooming Payroll Expenses 0
14630.17 6290 1380 0 Payroll Taxes
14630.17 6290 0 3525.19 Payroll Taxes-ee
14630.17 6290 3525.19 0 Payroll Taxes-ee
14630.17 6315 0 14.4 Disability Insurance
14630.17 6330 0 342 Medical/Dental Insurance
14630.17 6355 125.32 0 Retirement Plan Contributions

The next part I am unsure of. What I need to do is take the amounts in
column F and move them to the bottom of column C. I also need to eliminate
spaces. The catch is that this document may never be exactly the same so it
cannot be cell specific.

Any suggestions are greatly appreciated. This is my first time working with
macros. If you need more info please let me know.



Thanks,
--
Malissa

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 to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


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