LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Coding to choose the previous completed cell in a column

Hi,

I have used the Macro recorder to create a macro for me however when I apply
the macro to other similar worksheets in bombs out. What I have recorded is
for the macro in whatever column to go back to column A in the row and then
go up to the previously filled cell in column A and complete a set function.

What the recorder records is a change in the number of cells (0, -15) or
whatever and it then applies that movement change to all future runnings.

Coding is as follows ( I hope this helps)

ActiveCell.Offset(0, 1).Range("A1:I1").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
ActiveCell.Offset(0, 9).Range("A1:B1").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown
ActiveCell.Offset(0, 5).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown
ActiveCell.Offset(0, -15).Range("A1").Select
Selection.Cut
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.ClearContents
End Sub

I don't want it to recorded the number of times I've moved up...just the
fact that I've moved up. When I recorded it I use the Ctrl+(up arrow) to
record the movement however it has given this a literal value of -15.

I am trying to move around the worksheet using Ctrl+ and each time is does
the above. I'm also selecting cells in a similar way by selecting the cell
in a column (That is blank) and doing a Shift+Ctrl+up arrow and doing a
Ctrl+D to fill the calculations held in the first cell.

This also doesn't work as it's taking literal cell movements.

I hope that someone is able to help me
 
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
choose last cell with a value in a column jcheko Excel Discussion (Misc queries) 6 December 8th 09 02:50 PM
Create formula to choose price based on previous choice. lindsielynette Excel Worksheet Functions 2 January 11th 07 01:55 AM
Hiding column if cell in previous column is empty-revised [email protected] Excel Programming 2 January 4th 07 06:45 AM
How to indicate in formula to choose the entire column starting from a specified cell? [email protected] Excel Discussion (Misc queries) 3 June 13th 06 04:25 AM
Referring to Previous Worksheet - coding Denis Excel Worksheet Functions 7 December 10th 04 05:24 PM


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