ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is this wrong? (https://www.excelbanter.com/excel-programming/342575-wrong.html)

Ctech[_23_]

Is this wrong?
 

VBA CODE:

PivotRange = Range("C" & myRows & ":" & endColumn)

QUESTION:

Is this VBA code wrong to get the example below


*i.e. *

PivotRange = Range("C12343:D4")


--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=475452


Ctech[_24_]

Is this wrong?
 

No replies, does this meens that there is nothing wrong with my code?


--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=475452


Tom Ogilvy

Is this wrong?
 
depends on what is in your variables

MyRows = 132343
EndColumn = "D4"

would provide what you show.

if endcolumn = 4 then

PivotRange = Range("C" & myRows & ":D" & endColumn)

--
Regards,
Tom Ogilvy


"Ctech" wrote in
message ...

VBA CODE:

PivotRange = Range("C" & myRows & ":" & endColumn)

QUESTION:

Is this VBA code wrong to get the example below


*i.e. *

PivotRange = Range("C12343:D4")


--
Ctech
------------------------------------------------------------------------
Ctech's Profile:

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




Ron de Bruin

Is this wrong?
 
Hi Ctech

Try it like this

Sub test()
Dim PivotRange As Range
Dim myRows As Long
Dim endColumn As Integer
myRows = 12
endColumn = 4
Set PivotRange = Range(Cells(myRows, "C"), Cells(4, endColumn))
PivotRange.Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ctech" wrote in message
...

VBA CODE:

PivotRange = Range("C" & myRows & ":" & endColumn)

QUESTION:

Is this VBA code wrong to get the example below


*i.e. *

PivotRange = Range("C12343:D4")


--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=475452




Ctech[_26_]

Is this wrong?
 

How can i make

myColumn = cell.column
i.e
myColumn = D

So far I have managed to get D5 or just (4, which I guess is D in
number form)


--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=475452



All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com