Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 21
Default macro upgrade

i have this piece of code....

it gets the seeen columns of data from column A and pastes it into column K...
the length of data in column A changes , so this macro can do that ...

here it is ..

Sub select_data()

Sheets("sheet1").Select
Range("k1:k500").Select
Selection.ClearContents

Dim ulhc As String 'upper left hand corner
Dim lrhc As String 'lower right hand corner
Dim wdth As Integer 'true width in columns

ulhc = "$a$6"
wdth = 1



Application.Goto Range(ulhc) 'goto upper left hand corner
ActiveCell.Offset(0, wdth - 1).Select 'move to edge of data (column)
lrhc = Selection.End(xlDown).Address 'get address of lrhc

Range(ulhc & ":" & lrhc).Select
Selection.Copy


Sheets("sheet1").Select
Range("$k$1").Select
' Range("$ad$6").Select
'ActiveCell.Select
ActiveSheet.Paste
Application.CutCopyMode = False


End Sub


now what i want to do is this .....

to this macro i want to a piece of code that will take the data from column K
and add to that 0.01%

can some one help me with the code pls.....

sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default macro upgrade

Hi,

First of all, there is no need to select things to work
with them.

This is one way to do what you want:

Sub select_data()
Dim ulhc As String 'upper left hand corner
Dim wdth As Integer 'true width in columns
Dim oRange As Range
Dim ocell As Range
ulhc = "$a$6"
wdth = 1
Sheets("sheet1").Range("k1:k500").ClearContents
With ActiveSheet
.Range(.Range(ulhc), _
.Range(ulhc).Offset(0, wdth - 1).End(xlDown)).Copy
_
Destination:=Sheets("sheet1").Range("$k$1")
Application.CutCopyMode = False
End With

With Sheets("sheet1")
Set oRange = .Range(.Range("$k$1"), .Range
("$k$1").End(xlDown).Offset(, wdth - 1))
End With

For Each ocell In oRange.Cells
ocell = ocell * 1.01
Next
End Sub




Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
i have this piece of code....

it gets the seeen columns of data from column A and

pastes it into column K...
the length of data in column A changes , so this macro

can do that ...

here it is ..

Sub select_data()

Sheets("sheet1").Select
Range("k1:k500").Select
Selection.ClearContents

Dim ulhc As String 'upper left hand

corner
Dim lrhc As String 'lower right hand

corner
Dim wdth As Integer 'true width in columns

ulhc = "$a$6"
wdth = 1



Application.Goto Range(ulhc) 'goto upper

left hand corner
ActiveCell.Offset(0, wdth - 1).Select 'move to edge

of data (column)
lrhc = Selection.End(xlDown).Address 'get address

of lrhc

Range(ulhc & ":" & lrhc).Select
Selection.Copy


Sheets("sheet1").Select
Range("$k$1").Select
' Range("$ad$6").Select
'ActiveCell.Select
ActiveSheet.Paste
Application.CutCopyMode = False


End Sub


now what i want to do is this .....

to this macro i want to a piece of code that will take

the data from column K
and add to that 0.01%

can some one help me with the code pls.....

sam
.

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
macro stopped working after upgrade to 2007 mohavv Excel Discussion (Misc queries) 1 June 16th 09 01:38 AM
Excel upgrade TStright Excel Discussion (Misc queries) 11 October 4th 07 06:23 PM
2007 Upgrade wont run macro BrianW Excel Discussion (Misc queries) 0 June 26th 07 04:44 AM
New Macro error after Office Upgrade Marc Excel Discussion (Misc queries) 9 March 3rd 06 09:10 PM
Excel upgrade unionlady2 Setting up and Configuration of Excel 3 February 22nd 06 12:39 AM


All times are GMT +1. The time now is 05:51 PM.

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"