Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting Range


Hi all,

How do you select an Activecell.Offset range? As I am trying to copy
the cells to the left of the ActiveCell.Select.


Code:
--------------------

Range(ActiveCell.Offset(0, 0):ActiveCell.Offset(0, 1)).Select
Selection.Copy

--------------------


Something like the above....?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=514841

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Selecting Range

Activecell.Resize(,2).Copy

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"gti_jobert" wrote
in message ...

Hi all,

How do you select an Activecell.Offset range? As I am trying to copy
the cells to the left of the ActiveCell.Select.


Code:
--------------------

Range(ActiveCell.Offset(0, 0):ActiveCell.Offset(0, 1)).Select
Selection.Copy

--------------------


Something like the above....?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:

http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=514841



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting Range


Hi again,

The code below works fine to delete a row.....but if row columns A an
B contain data then i want to copy the values, delete the row the
paste the new values into the new row. I have highlighted in red th
code that needs to be able to perform this operation, any hel
appreciated!


Code
-------------------

Public Sub DelIndividual()

Dim i%, start%, finish%
Dim s$, f$, r$, flag As Boolean

flag = False
'check for valid cell selection
If (ActiveCell.Column = 3) And (ActiveCell.Value < "") Then
start = ActiveCell.Row
i = start
Do
i = i + 1
Loop Until (Cells(i, 3).Value < "") Or (Cells(i, 7).Value = "") And (Cells(i, 8).Value = "")
finish = i - 1
ActiveSheet.Rows(start).Select
'confirm
r = MsgBox("Do you want to permanently delete this record?", 52, "Delete")
If r = vbYes Then
'delete the whole record
ActiveSheet.Unprotect Password:=Pass

If ActiveCell.Offset(0, 0) < "" And ActiveCell.Offset(0, 1) < "" Then
'copy data and set flag
ActiveCell.Resize(, 2).Copy
flag = True
End If
For i = start To finish
ActiveSheet.Rows(start).Delete
Next

If flag = True Then
ActiveCell.Resize(, 2).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End If
ActiveSheet.Protect Password:=Pass
End If
ActiveCell.Offset(0, 0).Select
End If

End Sub


-------------------


Thanks for the code before bob, not too sure how to encorporate i
though

--
gti_jober
-----------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...fo&userid=3063
View this thread: http://www.excelforum.com/showthread.php?threadid=51484

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Selecting Range

In sheet1 with cell (say) B3 the active cell
and with A3 containing the Value 123
Run:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2/21/2006 by Jim May
'

'
ActiveCell.Offset(0, -1).Range("A1").Copy
Sheets("Sheet2").Activate
Range("D1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

Sheet2, Cell D1 will now contain the 123.

HTH

"gti_jobert" wrote
in message ...

Hi all,

How do you select an Activecell.Offset range? As I am trying to copy
the cells to the left of the ActiveCell.Select.


Code:
--------------------

Range(ActiveCell.Offset(0, 0):ActiveCell.Offset(0, 1)).Select
Selection.Copy

--------------------


Something like the above....?


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:
http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=514841



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting Range


Code:
--------------------

If ActiveCell.Offset(0, 0) < "" And ActiveCell.Offset(0, 1) < "" Then
'copy data and set flag
ActiveCell.Resize(, 2).Copy
ActiveCell.Resize(1, 2).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End If

--------------------


Got this now, but its not pasting the row values into the row below
it....any ideas?

Cheers guys.


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=514841



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting Range


Code:
--------------------

If ActiveCell.Offset(0, 0) < "" And ActiveCell.Offset(0, 1) < "" Then
'copy data and set flag
ActiveCell.Resize(, 2).Copy
ActiveCell.Resize(*2*, 2).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End If

--------------------


Sorted it!!


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=514841

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
Please help with selecting a range keri Excel Discussion (Misc queries) 7 December 12th 06 08:56 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
selecting a range jhahes[_12_] Excel Programming 1 July 5th 05 08:57 PM
Help please in selecting range dependent on another range MickJJ Excel Programming 2 January 10th 05 12:01 PM
Selecting a Range inside a range hcova Excel Programming 0 July 13th 04 03:26 PM


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