Variables and formating

keeegs

Board Regular
Joined
Sep 25, 2011
Messages
145
Hi All

At the moment I have a macro that prints out a label depending on the information that is on a userform

My problem is that I have a date and it needs to me in the format dd-mmm-yy

At the moment I set the value from the DTPicker to a variable I4

The position that the date appears on the label can very depending on the type of the label.

Is there a way to set the format on the variable I4 so it doesnt matter what cell it is in?

Currently I am using:
Code:
ActiveCell.Offset(4, 1).NumberFormat = "dd-mmm-yy"

after I have put the data to a cell.

Any suggestions?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
The only problem is that the cell that the information is in changes.
So thats why I want the string to already be in the format dd-mmm-yy as the information is used multiple times depending on how many labels they want
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,780
Members
449,049
Latest member
greyangel23

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