#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ChuckF
 
Posts: n/a
Default Macro help

Can a macro start from wherever cell the active cursor is on? or
perhaps from the cell that the macro button is clicked?

What I am trying to do is copy the data from F(whatever) to whatever
the last empty cell is in the row holds the active cursor. Or I can
create buttons for the macro to run, and it could copy the information
in that particular row.

I don't know if this makes sense or not...I would be greatful for any
help.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ChuckF
 
Posts: n/a
Default Macro help

Don,
Thank you for your time...not sure what I am doing wrong, but this
isn't working for me.

Again, I'm not sure if it is a macro that I need. basically what I am
trying to do is this...
I have a column to enter a date field when paperwork is recieved. Once
this data is entered, I want the data copied to another cell, so that I
can keep a running total of dates the paperwork was recieved, but I
want to keep the actual cell where we input this data clear. SO...I
enter the date of 4/1/2006 in cell J2. 4/1/2006 is copied to Z2, and
J2 is cleared. I then enter 4/5/2006 in cell J2 and it copies 4/5/06
to AA2.

Any help would be wonderful.
Thank you again for your time.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Scoops
 
Posts: n/a
Default Macro help

Hi ChuckF

Try this in your worksheet's code (right-click the sheet tab and select
View Code):

Private Sub Worksheet_Change(ByVal Target As Range)
Dim newcell As Range
If Target < Range("J2") Then Exit Sub
Application.EnableEvents = False
Set newcell = Range("IV2").End(xlToLeft).Offset(0, 1)
If newcell.Column < 26 Then
Range("Z2").Value = Target
Else
newcell.Value = Target
End If
Set newcell = Nothing
Target.Select
Target.ClearContents
Application.EnableEvents = True
End Sub

I don't know if you wanted Z to be the first column to include your
data but I put the check in anyway, remove it if it's not necessary.

Be aware that there are only 256 columns in a worksheet. If you're
going to be entering a lot of data you might want to consider going
down rows rather than across columns.

Regards

Steve

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ChuckF
 
Posts: n/a
Default Macro help

Steve,
Many thanks...I have tested this in a dummysheet, and it appears to
work beautifuly. Can you tell me what adjustments need to made for the
following to occur...

Only when I enter a date in column L2 AND M2 would I like the
information copied from J2 to Z2(or 3 or wherever)
I would also like this to occur in these colulmns....not just the 2nd
row.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Scoops
 
Posts: n/a
Default Macro help

Hi ChuckF

I *think* you're changing the column emphasis from J to L&M, if that's
the case, try this:

Dim newcell As Range
With Target
If Cells(.Row, "L") = "" Or Cells(.Row, "M") = "" Then Exit Sub

Application.EnableEvents = False

Set newcell = Cells(.Row, "IV").End(xlToLeft).Offset(0, 1)
With Cells(.Row, "J")
If newcell.Column < 26 Then
Cells(.Row, "Z").Value = .Value
Else
newcell.Value = .Value
End If
.ClearContents
End With
End With
Set newcell = Nothing
Application.EnableEvents = True
End Sub

Regards

Steve

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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


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