select range by macro

needhelp2

Active Member
Joined
Apr 19, 2011
Messages
250
Hi,

I am using office 2010 i am creating relative macro for cells.

I am facing issue that on relative select its not selecting relative cell.Its only select select same range which i assigned while creating.
How i can fix it? PFB code.Thanks In advance.


BR,
Smith.


Code:
Sub Macro2()
'
' Macro2 Macro
'

'
    ActiveCell.Select
    Range("a:z").Select
        Selection.End(xlToLeft).Select
    Range("a5:c6").Select
    With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
        "C:\Documents and Settings\andy\Desktop\sPage.htm", "Example", "$A$7:$D$11", _
        xlHtmlStatic, "example+table+for+html_25881", "")
        .Publish (True)
        .AutoRepublish = False
    End With
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
The critical piece of information that's missing is, relative to what?
 
Upvote 0
Thanks for your reply.I was ill so that i could came online.well i mean to say that i was creating macro with relative reference, mean it work when ever i select cell throughout sheet.
 
Upvote 0
OK, let me rephrase the question. What was the range you originally assigned, was it $A$7:$D$11?

Say in words what result you want to accomplish, it's difficult to make out from the code because the macro recorded your every move and not all of them are necessary.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top