Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default Writing macros to sequentially change the address of a cell in


--
Ken living downunder


"Ken Johnson" wrote:

Hi Ken,

This version only requires one simple change to change the cell used as
the input cell.
For example, if C55 is your input cell then you only have to change the
first line to...

Dim rngInput As Range: Set rngInput = Range("C55")

Private Sub Worksheet_Change(ByVal Target As Range)
'Change the address string below to suit your needs
Dim rngInput As Range: Set rngInput = Range("B3") '<<<
If Not Intersect(Target, rngInput) Is Nothing Then
If Cells(Rows.Count, rngInput.Column).End(xlUp).Row = _
rngInput.Row And rngInput.Offset(1, 0).Value < "" Then
MsgBox "You have reached the bottom of the sheet!"
Exit Sub
End If
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
Dim rngOld As Range, rngNew As Range
Set rngOld = Range(rngInput, Cells(Cells(Rows.Count, _
rngInput.Column).End(xlUp).Row, rngInput.Column))
Set rngNew = rngOld.Offset(1, 0)
rngNew.Value = rngOld.Value
With rngInput
.ClearContents
.Select
End With
Application.EnableEvents = True
End If
Exit Sub
ERRORHANDLER: Application.EnableEvents = True
End Sub


Ken Johnson


Hi Ken again

Thanks for your follow up

Best regards

Ken Pearson

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
Writing macros to sequentially change the address of a cell in Exc Rod Gill Excel Programming 2 January 14th 07 09:55 AM
Writing macros to sequentially change the address of a cell in Ken Excel Programming 3 December 28th 06 03:00 AM
Writing macros to sequentially change the address of a cell in Ken Excel Programming 0 December 24th 06 12:23 AM
Concatenate cells without specifying/writing cell address individually Hari Excel Discussion (Misc queries) 4 January 3rd 05 06:05 PM
Writing a DLL using Visual Studio 6 to return cell address! agarwaldvk Excel Programming 3 July 5th 04 10:40 AM


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