Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I use an activecell as coordinates for pasteing?


A sheet that I am working with uses hidden rows to do various bonus
features within a longer sheet. (a parts list)

Sometimes these parts are imported from a different sheet. My sheet is
set up to accommodate small, medium, or large numbers of parts. Today I
encountered a problem where someone tried to copy in so many items at
once that it overlapped a hidden row and caused an error due to trying
to write in locked cells.

What I would like to do is to have the user select the column that the
data will be imported into (could be description, qnty, price, etc) and
be able to press a button that will work in the following method (or a
better one if so suggested).

(I'm expecting data to already be in the clipboard.)
Save the location of the active cell when the button was pushed
Unlock a large selection of cells in an area of the form that is unused
(around "A500:A700")
Paste the values into this out of the way area. (probably count the
selection size, too)
Cut the first 40 entries.
Paste those entries into the area originally selected by the user.
Cut the next 48 entries.
Paste those entries into the next applicable area. (same column, row
offset by about 51)
Repeat the step with 48 entries.
If extra remains, notify the user that the selection was too big and
some data was truncated.
Delete any remaining data.
Lock the cells.

I'm having trouble with two areas. I can't figure out how to get usable
information from what cell was active when the macro is run. I can get
the row and the column separately, but don't know how to use them
after. Secondly, I'm having trouble with the destination I cut to.
(this related to my lack of knowledge of the first one, but I don’t
know how I should enter the cell co-ords).

Shown below is the smaller version I was playing with (I take baby
steps when writing programs because I'm still such a noob). Further
below that is how I have my variable size page set up incase some of
you are curious.

-Thanks

Sub Pastevalues()
co = ActiveCell.Column
ro = ActiveCell.Row
Range("A100").PasteSpecial Paste:=xlValues
Range("A100", "A104").Cut
Range("a1").Select
ActiveCell.Offset(ro, co).Select
ActiveCell.PasteSpecial xlPasteAll
Range("A104", "A110").Cut
Range("a1").Select
ActiveCell.Offset(ro, co).Select
ActiveCell.Offset(5, 0).Select
ActiveCell.PasteSpecial xlPasteAll
End Sub
__________________________________________________ ______________
Sub smallsheet(targ)
Call WSunlock(targ)
With Sheets(targ)
If .Range("z1").Value = 0 And .Range("z2").Value = 0 Then
Application.ScreenUpdating = False
..Rows("11:155").Hidden = False
..Rows("54:155").Hidden = True
Application.ScreenUpdating = True
Else
MsgBox "Existing values exceed requested sheet size.", vbOKOnly
End If
End With
Call WSlock(targ)
End Sub

Sub medsheet(targ)
Call WSunlock(targ)
With Sheets(targ)
If Range("z2").Value = 0 Then
Application.ScreenUpdating = False
Range("A11:J155").Select
Selection.EntireRow.Hidden = False
Range("A105:J155").Select
Selection.EntireRow.Hidden = True
Range("A51:A53").Select
Selection.EntireRow.Hidden = True
Application.ScreenUpdating = True
Else
MsgBox "Existing values exceed requested sheet size.", vbOKOnly
End If
End With
Call WSlock(targ)
End Sub

Sub largesheet(targ)
Call WSunlock(targ)
With Sheets(targ)
Application.ScreenUpdating = False
Range("A11:J155").Select
Selection.EntireRow.Hidden = False
Range("A51:A53").Select
Selection.EntireRow.Hidden = True
Range("A102:A104").Select
Selection.EntireRow.Hidden = True
Application.ScreenUpdating = True
End With
Call WSlock(targ)
End Sub


--
wilro85
------------------------------------------------------------------------
wilro85's Profile: http://www.excelforum.com/member.php...o&userid=26935
View this thread: http://www.excelforum.com/showthread...hreadid=493489

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I use an activecell as coordinates for pasteing?


Nevermind, I found my answer in another users question.

I have to use "cells(x,y)

--
wilro8
-----------------------------------------------------------------------
wilro85's Profile: http://www.excelforum.com/member.php...fo&userid=2693
View this thread: http://www.excelforum.com/showthread.php?threadid=49348

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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
Pasteing formula gives blank result garin Excel Worksheet Functions 0 August 3rd 06 01:11 PM
Saving ActiveCell coordinates James Duncan Excel Programming 6 October 24th 04 08:08 PM
Simple way to convert UTM ED50 coordinates to decimal coordinates? Dan[_38_] Excel Programming 8 July 11th 04 04:54 PM
Converting MouseDown Coordinates to Chart Point Coordinates Steve[_50_] Excel Programming 3 December 2nd 03 06:48 PM


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